Skip to content

Commit 50eecd0

Browse files
committed
Merge tag 'llvmorg-17.0.0-rc3' into rustc/17.0-2023-07-29
LLVM 17.0.0-rc3 Release
2 parents 1833c2b + 5bd2c0c commit 50eecd0

File tree

125 files changed

+5790
-1212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+5790
-1212
lines changed

clang-tools-extra/clangd/SystemIncludeExtractor.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ struct DriverArgs {
136136
}
137137
}
138138

139+
// Downgrade objective-c++-header (used in clangd's fallback flags for .h
140+
// files) to c++-header, as some drivers may fail to run the extraction
141+
// command if it contains `-xobjective-c++-header` and objective-c++ support
142+
// is not installed.
143+
// In practice, we don't see different include paths for the two on
144+
// clang+mac, which is the most common objectve-c compiler.
145+
if (Lang == "objective-c++-header") {
146+
Lang = "c++-header";
147+
}
148+
139149
// If language is not explicit in the flags, infer from the file.
140150
// This is important as we want to cache each language separately.
141151
if (Lang.empty()) {

clang/docs/ReleaseNotes.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ Modified Compiler Flags
309309
directory (``/tmp`` on \*NIX systems, if none of the environment variables
310310
TMPDIR, TMP, and TEMP are specified).
311311

312-
- ``-ffat-lto-objects`` can now be used to emit object files with both object
313-
code and LLVM bitcode. Previously this flag was ignored for GCC compatibility.
314-
(`See related patch <https://reviews.llvm.org/D146777>`_).
315-
316312
Removed Compiler Flags
317313
-------------------------
318314
- The deprecated flag `-fmodules-ts` is removed. Please use ``-std=c++20``
@@ -481,7 +477,6 @@ Bug Fixes in This Version
481477
instantiated in one module and whose definition is instantiated in another
482478
module may end up with members associated with the wrong declaration of the
483479
class, which can result in miscompiles in some cases.
484-
485480
- Added a new diagnostic warning group
486481
``-Wdeprecated-redundant-constexpr-static-def``, under the existing
487482
``-Wdeprecated`` group. This controls warnings about out-of-line definitions
@@ -704,6 +699,9 @@ Bug Fixes in This Version
704699
(`#64005 <https://github.com/llvm/llvm-project/issues/64005>_`)
705700
- Fix crash on nested templated class with template function call.
706701
(`#61159 <https://github.com/llvm/llvm-project/issues/61159>_`)
702+
- Fix a hang on valid C code passing a function type as an argument to
703+
``typeof`` to form a function declaration.
704+
(`#64713 <https://github.com/llvm/llvm-project/issues/64713>_`)
707705

708706
Bug Fixes to Compiler Builtins
709707
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/CodeGenOptions.def

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the
165165
///< compile step.
166166
CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole
167167
///< program vtable opt).
168-
CODEGENOPT(FatLTO, 1, 0) ///< Set when -ffat-lto-objects is enabled.
169168
CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support
170169
/// CFI and traditional whole program
171170
/// devirtualization that require whole

clang/include/clang/Driver/Options.td

+9-5
Original file line numberDiff line numberDiff line change
@@ -2375,11 +2375,6 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
23752375
Flags<[CoreOption, CC1Option]>, Group<f_Group>,
23762376
HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
23772377
MarshallingInfoString<CodeGenOpts<"ThinLinkBitcodeFile">>;
2378-
defm fat_lto_objects : BoolFOption<"fat-lto-objects",
2379-
CodeGenOpts<"FatLTO">, DefaultFalse,
2380-
PosFlag<SetTrue, [CC1Option], "Enable">,
2381-
NegFlag<SetFalse, [CC1Option], "Disable">,
2382-
BothFlags<[CC1Option], " fat LTO object support">>;
23832378
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
23842379
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
23852380
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
@@ -5097,6 +5092,10 @@ def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group<
50975092
def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group<m_x86_Features_Group>;
50985093
def mvzeroupper : Flag<["-"], "mvzeroupper">, Group<m_x86_Features_Group>;
50995094
def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
5095+
def mno_gather : Flag<["-"], "mno-gather">, Group<m_x86_Features_Group>,
5096+
HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
5097+
def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_x86_Features_Group>,
5098+
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
51005099

51015100
// These are legacy user-facing driver-level option spellings. They are always
51025101
// aliases for options that are spelled using the more common Unix / GNU flag
@@ -5162,6 +5161,7 @@ defm caller_saves : BooleanFFlag<"caller-saves">, Group<clang_ignored_gcc_optimi
51625161
defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>;
51635162
defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group<clang_ignored_gcc_optimization_f_Group>;
51645163
defm default_inline : BooleanFFlag<"default-inline">, Group<clang_ignored_gcc_optimization_f_Group>;
5164+
defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group<clang_ignored_gcc_optimization_f_Group>;
51655165
defm float_store : BooleanFFlag<"float-store">, Group<clang_ignored_gcc_optimization_f_Group>;
51665166
defm friend_injection : BooleanFFlag<"friend-injection">, Group<clang_ignored_f_Group>;
51675167
defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group<clang_ignored_f_Group>;
@@ -7152,6 +7152,10 @@ def _SLASH_QIntel_jcc_erratum : CLFlag<"QIntel-jcc-erratum">,
71527152
Alias<mbranches_within_32B_boundaries>;
71537153
def _SLASH_arm64EC : CLFlag<"arm64EC">,
71547154
HelpText<"Set build target to arm64ec">;
7155+
def : CLFlag<"Qgather-">, Alias<mno_gather>,
7156+
HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
7157+
def : CLFlag<"Qscatter-">, Alias<mno_scatter>,
7158+
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
71557159

71567160
// Non-aliases:
71577161

clang/lib/CodeGen/BackendUtil.cpp

+1-22
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "llvm/Target/TargetOptions.h"
5656
#include "llvm/TargetParser/SubtargetFeature.h"
5757
#include "llvm/TargetParser/Triple.h"
58-
#include "llvm/Transforms/IPO/EmbedBitcodePass.h"
5958
#include "llvm/Transforms/IPO/LowerTypeTests.h"
6059
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
6160
#include "llvm/Transforms/InstCombine/InstCombine.h"
@@ -1016,12 +1015,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10161015
});
10171016
}
10181017

1019-
bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO);
1020-
if (CodeGenOpts.FatLTO) {
1021-
MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO,
1022-
IsThinOrUnifiedLTO ||
1023-
shouldEmitRegularLTOSummary());
1024-
} else if (IsThinOrUnifiedLTO) {
1018+
if (IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO)) {
10251019
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
10261020
} else if (IsLTO) {
10271021
MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
@@ -1077,21 +1071,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10771071
EmitLTOSummary));
10781072
}
10791073
}
1080-
if (CodeGenOpts.FatLTO) {
1081-
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
1082-
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1083-
bool IsThinOrUnifiedLTO =
1084-
CodeGenOpts.PrepareForThinLTO ||
1085-
(CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO);
1086-
if (!TheModule->getModuleFlag("ThinLTO"))
1087-
TheModule->addModuleFlag(Module::Error, "ThinLTO",
1088-
uint32_t(IsThinOrUnifiedLTO));
1089-
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
1090-
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
1091-
uint32_t(CodeGenOpts.EnableSplitLTOUnit));
1092-
if (CodeGenOpts.UnifiedLTO && !TheModule->getModuleFlag("UnifiedLTO"))
1093-
TheModule->addModuleFlag(Module::Error, "UnifiedLTO", uint32_t(1));
1094-
}
10951074

10961075
// Now that we have all of the passes ready, run them.
10971076
{

clang/lib/CodeGen/CGCXXABI.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ void CGCXXABI::setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
312312
llvm::GlobalValue::LinkageTypes CGCXXABI::getCXXDestructorLinkage(
313313
GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const {
314314
// Delegate back to CGM by default.
315-
return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage,
316-
/*IsConstantVariable=*/false);
315+
return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage);
317316
}
318317

319318
bool CGCXXABI::NeedsVTTParameter(GlobalDecl GD) {

clang/lib/CodeGen/CGCall.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "CGCall.h"
1515
#include "ABIInfo.h"
16+
#include "ABIInfoImpl.h"
1617
#include "CGBlocks.h"
1718
#include "CGCXXABI.h"
1819
#include "CGCleanup.h"
@@ -5759,9 +5760,14 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
57595760
DestIsVolatile = false;
57605761
}
57615762

5762-
// If the value is offset in memory, apply the offset now.
5763-
Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI);
5764-
CreateCoercedStore(CI, StorePtr, DestIsVolatile, *this);
5763+
// An empty record can overlap other data (if declared with
5764+
// no_unique_address); omit the store for such types - as there is no
5765+
// actual data to store.
5766+
if (!isEmptyRecord(getContext(), RetTy, true)) {
5767+
// If the value is offset in memory, apply the offset now.
5768+
Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI);
5769+
CreateCoercedStore(CI, StorePtr, DestIsVolatile, *this);
5770+
}
57655771

57665772
return convertTempToRValue(DestPtr, RetTy, SourceLocation());
57675773
}

clang/lib/CodeGen/CGDebugInfo.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,14 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
391391
SourceManager &SM = CGM.getContext().getSourceManager();
392392
StringRef FileName;
393393
FileID FID;
394+
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
394395

395396
if (Loc.isInvalid()) {
396397
// The DIFile used by the CU is distinct from the main source file. Call
397398
// createFile() below for canonicalization if the source file was specified
398399
// with an absolute path.
399400
FileName = TheCU->getFile()->getFilename();
401+
CSInfo = TheCU->getFile()->getChecksum();
400402
} else {
401403
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
402404
FileName = PLoc.getFilename();
@@ -417,13 +419,14 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
417419
return cast<llvm::DIFile>(V);
418420
}
419421

422+
// Put Checksum at a scope where it will persist past the createFile call.
420423
SmallString<64> Checksum;
421-
422-
std::optional<llvm::DIFile::ChecksumKind> CSKind =
424+
if (!CSInfo) {
425+
std::optional<llvm::DIFile::ChecksumKind> CSKind =
423426
computeChecksum(FID, Checksum);
424-
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
425-
if (CSKind)
426-
CSInfo.emplace(*CSKind, Checksum);
427+
if (CSKind)
428+
CSInfo.emplace(*CSKind, Checksum);
429+
}
427430
return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc)));
428431
}
429432

clang/lib/CodeGen/CGDebugInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class CGDebugInfo {
148148
llvm::BumpPtrAllocator DebugInfoNames;
149149
StringRef CWDName;
150150

151-
llvm::StringMap<llvm::TrackingMDRef> DIFileCache;
151+
llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache;
152152
llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache;
153153
/// Cache declarations relevant to DW_TAG_imported_declarations (C++
154154
/// using declarations and global alias variables) that aren't covered

clang/lib/CodeGen/CGDecl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void CodeGenFunction::EmitVarDecl(const VarDecl &D) {
202202
return;
203203

204204
llvm::GlobalValue::LinkageTypes Linkage =
205-
CGM.getLLVMLinkageVarDefinition(&D, /*IsConstant=*/false);
205+
CGM.getLLVMLinkageVarDefinition(&D);
206206

207207
// FIXME: We need to force the emission/use of a guard variable for
208208
// some variables even if we can constant-evaluate them because

clang/lib/CodeGen/CGExpr.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -2692,8 +2692,7 @@ static LValue EmitGlobalNamedRegister(const VarDecl *VD, CodeGenModule &CGM) {
26922692
/// this context.
26932693
static bool canEmitSpuriousReferenceToVariable(CodeGenFunction &CGF,
26942694
const DeclRefExpr *E,
2695-
const VarDecl *VD,
2696-
bool IsConstant) {
2695+
const VarDecl *VD) {
26972696
// For a variable declared in an enclosing scope, do not emit a spurious
26982697
// reference even if we have a capture, as that will emit an unwarranted
26992698
// reference to our capture state, and will likely generate worse code than
@@ -2726,7 +2725,7 @@ static bool canEmitSpuriousReferenceToVariable(CodeGenFunction &CGF,
27262725
// We can emit a spurious reference only if the linkage implies that we'll
27272726
// be emitting a non-interposable symbol that will be retained until link
27282727
// time.
2729-
switch (CGF.CGM.getLLVMLinkageVarDefinition(VD, IsConstant)) {
2728+
switch (CGF.CGM.getLLVMLinkageVarDefinition(VD)) {
27302729
case llvm::GlobalValue::ExternalLinkage:
27312730
case llvm::GlobalValue::LinkOnceODRLinkage:
27322731
case llvm::GlobalValue::WeakODRLinkage:
@@ -2757,7 +2756,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
27572756
// constant value directly instead.
27582757
if (E->isNonOdrUse() == NOUR_Constant &&
27592758
(VD->getType()->isReferenceType() ||
2760-
!canEmitSpuriousReferenceToVariable(*this, E, VD, true))) {
2759+
!canEmitSpuriousReferenceToVariable(*this, E, VD))) {
27612760
VD->getAnyInitializer(VD);
27622761
llvm::Constant *Val = ConstantEmitter(*this).emitAbstract(
27632762
E->getLocation(), *VD->evaluateValue(), VD->getType());
@@ -2859,7 +2858,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
28592858
// some reason; most likely, because it's in an outer function.
28602859
} else if (VD->isStaticLocal()) {
28612860
llvm::Constant *var = CGM.getOrCreateStaticVarDecl(
2862-
*VD, CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false));
2861+
*VD, CGM.getLLVMLinkageVarDefinition(VD));
28632862
addr = Address(
28642863
var, ConvertTypeForMem(VD->getType()), getContext().getDeclAlign(VD));
28652864

clang/lib/CodeGen/CGExprConstant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) {
19181918

19191919
if (VD->isLocalVarDecl()) {
19201920
return CGM.getOrCreateStaticVarDecl(
1921-
*VD, CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false));
1921+
*VD, CGM.getLLVMLinkageVarDefinition(VD));
19221922
}
19231923
}
19241924
}

clang/lib/CodeGen/CGOpenMPRuntime.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ Address CGOpenMPRuntime::getAddrOfDeclareTargetVar(const VarDecl *VD) {
16671667
auto AddrOfGlobal = [&VD, this]() { return CGM.GetAddrOfGlobal(VD); };
16681668

16691669
auto LinkageForVariable = [&VD, this]() {
1670-
return CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false);
1670+
return CGM.getLLVMLinkageVarDefinition(VD);
16711671
};
16721672

16731673
std::vector<llvm::GlobalVariable *> GeneratedRefs;
@@ -10170,7 +10170,7 @@ void CGOpenMPRuntime::registerTargetGlobalVariable(const VarDecl *VD,
1017010170

1017110171
auto AddrOfGlobal = [&VD, this]() { return CGM.GetAddrOfGlobal(VD); };
1017210172
auto LinkageForVariable = [&VD, this]() {
10173-
return CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false);
10173+
return CGM.getLLVMLinkageVarDefinition(VD);
1017410174
};
1017510175

1017610176
std::vector<llvm::GlobalVariable *> GeneratedRefs;

clang/lib/CodeGen/CodeGenFunction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ llvm::ConstantInt *
572572
CodeGenFunction::getUBSanFunctionTypeHash(QualType Ty) const {
573573
// Remove any (C++17) exception specifications, to allow calling e.g. a
574574
// noexcept function through a non-noexcept pointer.
575-
if (!isa<FunctionNoProtoType>(Ty))
575+
if (!Ty->isFunctionNoProtoType())
576576
Ty = getContext().getFunctionTypeWithExceptionSpec(Ty, EST_None);
577577
std::string Mangled;
578578
llvm::raw_string_ostream Out(Mangled);

clang/lib/CodeGen/CodeGenModule.cpp

+11-14
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) {
19741974
return llvm::GlobalValue::InternalLinkage;
19751975
}
19761976

1977-
return getLLVMLinkageForDeclarator(D, Linkage, /*IsConstantVariable=*/false);
1977+
return getLLVMLinkageForDeclarator(D, Linkage);
19781978
}
19791979

19801980
llvm::ConstantInt *CodeGenModule::CreateCrossDsoCfiTypeId(llvm::Metadata *MD) {
@@ -3645,6 +3645,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
36453645
if (MustBeEmitted(Global) && MayBeEmittedEagerly(Global)) {
36463646
// Emit the definition if it can't be deferred.
36473647
EmitGlobalDefinition(GD);
3648+
addEmittedDeferredDecl(GD);
36483649
return;
36493650
}
36503651

@@ -3664,7 +3665,6 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
36643665
// The value must be emitted, but cannot be emitted eagerly.
36653666
assert(!MayBeEmittedEagerly(Global));
36663667
addDeferredDeclToEmit(GD);
3667-
EmittedDeferredDecls[MangledName] = GD;
36683668
} else {
36693669
// Otherwise, remember that we saw a deferred decl with this name. The
36703670
// first use of the mangled name will cause it to move into
@@ -4404,7 +4404,6 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
44044404
// DeferredDeclsToEmit list, and remove it from DeferredDecls (since we
44054405
// don't need it anymore).
44064406
addDeferredDeclToEmit(DDI->second);
4407-
EmittedDeferredDecls[DDI->first] = DDI->second;
44084407
DeferredDecls.erase(DDI);
44094408

44104409
// Otherwise, there are cases we have to worry about where we're
@@ -4685,7 +4684,6 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
46854684
// Move the potentially referenced deferred decl to the DeferredDeclsToEmit
46864685
// list, and remove it from DeferredDecls (since we don't need it anymore).
46874686
addDeferredDeclToEmit(DDI->second);
4688-
EmittedDeferredDecls[DDI->first] = DDI->second;
46894687
DeferredDecls.erase(DDI);
46904688
}
46914689

@@ -5228,8 +5226,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
52285226
AddGlobalAnnotations(D, GV);
52295227

52305228
// Set the llvm linkage type as appropriate.
5231-
llvm::GlobalValue::LinkageTypes Linkage =
5232-
getLLVMLinkageVarDefinition(D, GV->isConstant());
5229+
llvm::GlobalValue::LinkageTypes Linkage = getLLVMLinkageVarDefinition(D);
52335230

52345231
// CUDA B.2.1 "The __device__ qualifier declares a variable that resides on
52355232
// the device. [...]"
@@ -5422,8 +5419,9 @@ static bool isVarDeclStrongDefinition(const ASTContext &Context,
54225419
return false;
54235420
}
54245421

5425-
llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageForDeclarator(
5426-
const DeclaratorDecl *D, GVALinkage Linkage, bool IsConstantVariable) {
5422+
llvm::GlobalValue::LinkageTypes
5423+
CodeGenModule::getLLVMLinkageForDeclarator(const DeclaratorDecl *D,
5424+
GVALinkage Linkage) {
54275425
if (Linkage == GVA_Internal)
54285426
return llvm::Function::InternalLinkage;
54295427

@@ -5493,10 +5491,10 @@ llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageForDeclarator(
54935491
return llvm::GlobalVariable::ExternalLinkage;
54945492
}
54955493

5496-
llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageVarDefinition(
5497-
const VarDecl *VD, bool IsConstant) {
5494+
llvm::GlobalValue::LinkageTypes
5495+
CodeGenModule::getLLVMLinkageVarDefinition(const VarDecl *VD) {
54985496
GVALinkage Linkage = getContext().GetGVALinkageForVariable(VD);
5499-
return getLLVMLinkageForDeclarator(VD, Linkage, IsConstant);
5497+
return getLLVMLinkageForDeclarator(VD, Linkage);
55005498
}
55015499

55025500
/// Replace the uses of a function that was declared with a non-proto type.
@@ -5708,7 +5706,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) {
57085706
Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(), DeclTy, LangAS::Default,
57095707
/*D=*/nullptr);
57105708
if (const auto *VD = dyn_cast<VarDecl>(GD.getDecl()))
5711-
LT = getLLVMLinkageVarDefinition(VD, D->getType().isConstQualified());
5709+
LT = getLLVMLinkageVarDefinition(VD);
57125710
else
57135711
LT = getFunctionLinkage(GD);
57145712
}
@@ -6339,8 +6337,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
63396337
}
63406338

63416339
// Create a global variable for this lifetime-extended temporary.
6342-
llvm::GlobalValue::LinkageTypes Linkage =
6343-
getLLVMLinkageVarDefinition(VD, Constant);
6340+
llvm::GlobalValue::LinkageTypes Linkage = getLLVMLinkageVarDefinition(VD);
63446341
if (Linkage == llvm::GlobalVariable::ExternalLinkage) {
63456342
const VarDecl *InitVD;
63466343
if (VD->isStaticDataMember() && VD->getAnyInitializer(InitVD) &&

0 commit comments

Comments
 (0)