diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCXXABI.h | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 40 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 21 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 96 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 18 | ||||
-rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 21 | ||||
-rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 7 |
10 files changed, 81 insertions, 140 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index c5c057e61b7..738c635d26f 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -205,7 +205,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, } // Finally, set up the alias with its proper name and attributes. - setAliasAttributes(AliasDecl, Alias); + SetCommonAttributes(AliasDecl, Alias); return false; } @@ -227,7 +227,6 @@ llvm::Function *CodeGenModule::codegenCXXStructor(const CXXMethodDecl *MD, } setFunctionLinkage(GD, Fn); - setFunctionDLLStorageClass(GD, Fn); CodeGenFunction(*this).GenerateCode(GD, Fn, FnInfo); setNonAliasAttributes(GD, Fn); diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h index 2262360d868..65a4c3d072e 100644 --- a/clang/lib/CodeGen/CGCXXABI.h +++ b/clang/lib/CodeGen/CGCXXABI.h @@ -433,6 +433,7 @@ public: /// base tables. virtual void emitVirtualInheritanceTables(const CXXRecordDecl *RD) = 0; + virtual bool exportThunk() = 0; virtual void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment) = 0; diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 41c1684b0de..52294c2034a 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -247,13 +247,6 @@ llvm::Constant *CodeGenModule::getOrCreateStaticVarDecl( if (D.getTLSKind()) setTLSMode(GV, D); - if (D.isExternallyVisible()) { - if (D.hasAttr<DLLImportAttr>()) - GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); - else if (D.hasAttr<DLLExportAttr>()) - GV->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass); - } - setGVProperties(GV, &D); // Make sure the result is of the correct type. diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index c8b8be7f455..57110467f61 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -1035,16 +1035,8 @@ llvm::Value *CGObjCGNU::GetClass(CodeGenFunction &CGF, const ObjCInterfaceDecl *OID) { auto *Value = GetClassNamed(CGF, OID->getNameAsString(), OID->isWeakImported()); - if (CGM.getTriple().isOSBinFormatCOFF()) { - if (auto *ClassSymbol = dyn_cast<llvm::GlobalVariable>(Value)) { - auto DLLStorage = llvm::GlobalValue::DefaultStorageClass; - if (OID->hasAttr<DLLExportAttr>()) - DLLStorage = llvm::GlobalValue::DLLExportStorageClass; - else if (OID->hasAttr<DLLImportAttr>()) - DLLStorage = llvm::GlobalValue::DLLImportStorageClass; - ClassSymbol->setDLLStorageClass(DLLStorage); - } - } + if (auto *ClassSymbol = dyn_cast<llvm::GlobalVariable>(Value)) + CGM.setGVProperties(ClassSymbol, OID); return Value; } @@ -1061,13 +1053,7 @@ llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) { if ((VD = dyn_cast<VarDecl>(Result))) break; - auto DLLStorage = llvm::GlobalValue::DefaultStorageClass; - if (!VD || VD->hasAttr<DLLImportAttr>()) - DLLStorage = llvm::GlobalValue::DLLImportStorageClass; - else if (VD->hasAttr<DLLExportAttr>()) - DLLStorage = llvm::GlobalValue::DLLExportStorageClass; - - ClassSymbol->setDLLStorageClass(DLLStorage); + CGM.setGVProperties(ClassSymbol, VD); } } return Value; @@ -2336,14 +2322,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { NULLPtr, NULLPtr, 0x12L, ClassName.c_str(), nullptr, Zeros[0], GenerateIvarList(empty, empty, empty), ClassMethodList, NULLPtr, NULLPtr, NULLPtr, ZeroPtr, ZeroPtr, true); - if (CGM.getTriple().isOSBinFormatCOFF()) { - auto Storage = llvm::GlobalValue::DefaultStorageClass; - if (OID->getClassInterface()->hasAttr<DLLImportAttr>()) - Storage = llvm::GlobalValue::DLLImportStorageClass; - else if (OID->getClassInterface()->hasAttr<DLLExportAttr>()) - Storage = llvm::GlobalValue::DLLExportStorageClass; - cast<llvm::GlobalValue>(MetaClassStruct)->setDLLStorageClass(Storage); - } + CGM.setGVProperties(cast<llvm::GlobalValue>(MetaClassStruct), + OID->getClassInterface()); // Generate the class structure llvm::Constant *ClassStruct = GenerateClassStructure( @@ -2351,14 +2331,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { llvm::ConstantInt::get(LongTy, instanceSize), IvarList, MethodList, GenerateProtocolList(Protocols), IvarOffsetArray, Properties, StrongIvarBitmap, WeakIvarBitmap); - if (CGM.getTriple().isOSBinFormatCOFF()) { - auto Storage = llvm::GlobalValue::DefaultStorageClass; - if (OID->getClassInterface()->hasAttr<DLLImportAttr>()) - Storage = llvm::GlobalValue::DLLImportStorageClass; - else if (OID->getClassInterface()->hasAttr<DLLExportAttr>()) - Storage = llvm::GlobalValue::DLLExportStorageClass; - cast<llvm::GlobalValue>(ClassStruct)->setDLLStorageClass(Storage); - } + CGM.setGVProperties(cast<llvm::GlobalValue>(ClassStruct), + OID->getClassInterface()); // Resolve the class aliases, if they exist. if (ClassPtrAlias) { diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 4060b7196bd..c3793b29a83 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -6305,9 +6305,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { llvm::GlobalVariable *MetaTClass = BuildClassObject(CI, /*metaclass*/ true, IsAGV, SuperClassGV, CLASS_RO_GV, classIsHidden); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (CI->hasAttr<DLLExportAttr>()) - MetaTClass->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(MetaTClass, CI); DefinedMetaClasses.push_back(MetaTClass); // Metadata for the class @@ -6347,9 +6345,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { llvm::GlobalVariable *ClassMD = BuildClassObject(CI, /*metaclass*/ false, MetaTClass, SuperClassGV, CLASS_RO_GV, classIsHidden); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (CI->hasAttr<DLLExportAttr>()) - ClassMD->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(ClassMD, CI); DefinedClasses.push_back(ClassMD); ImplementedClasses.push_back(CI); @@ -7524,12 +7520,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false, llvm::GlobalValue::ExternalLinkage, nullptr, EHTypeName); - if (CGM.getTriple().isOSBinFormatCOFF()) { - if (ID->hasAttr<DLLExportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); - else if (ID->hasAttr<DLLImportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); - } + CGM.setGVProperties(Entry, ID); return Entry; } } @@ -7568,10 +7559,8 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, CGM.getPointerAlign(), /*constant*/ false, L); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (hasObjCExceptionAttribute(CGM.getContext(), ID)) - if (ID->hasAttr<DLLExportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + if (hasObjCExceptionAttribute(CGM.getContext(), ID)) + CGM.setGVProperties(Entry, ID); } assert(Entry->getLinkage() == L); diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 275594237a5..4fb749fbde5 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -57,7 +57,12 @@ static void setThunkProperties(CodeGenModule &CGM, const ThunkInfo &Thunk, !Thunk.Return.isEmpty()); // Set the right visibility. - CGM.setGVProperties(ThunkFn, cast<CXXMethodDecl>(GD.getDecl())); + CGM.setGVProperties(ThunkFn, GD); + + if (!CGM.getCXXABI().exportThunk()) { + ThunkFn->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); + ThunkFn->setDSOLocal(true); + } if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker()) ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName())); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b157f5aff22..217f9639ba7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -777,8 +777,43 @@ void CodeGenModule::setDSOLocal(llvm::GlobalValue *GV) const { GV->setDSOLocal(true); } +void CodeGenModule::setDLLImportDLLExport(llvm::GlobalValue *GV, + GlobalDecl GD) const { + const auto *D = dyn_cast<NamedDecl>(GD.getDecl()); + if (const auto *Dtor = dyn_cast_or_null<CXXDestructorDecl>(D)) { + if (getCXXABI().useThunkForDtorVariant(Dtor, GD.getDtorType())) { + // Don't dllexport/import destructor thunks. + GV->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); + return; + } + } + setDLLImportDLLExport(GV, D); +} + +void CodeGenModule::setDLLImportDLLExport(llvm::GlobalValue *GV, + const NamedDecl *D) const { + if (D->isExternallyVisible()) { + if (D->hasAttr<DLLImportAttr>()) + GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); + else if (D->hasAttr<DLLExportAttr>() && !GV->isDeclarationForLinker()) + GV->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass); + } +} + +void CodeGenModule::setGVProperties(llvm::GlobalValue *GV, + GlobalDecl GD) const { + setDLLImportDLLExport(GV, GD); + setGlobalVisibilityAndLocal(GV, dyn_cast<NamedDecl>(GD.getDecl())); +} + void CodeGenModule::setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const { + setDLLImportDLLExport(GV, D); + setGlobalVisibilityAndLocal(GV, D); +} + +void CodeGenModule::setGlobalVisibilityAndLocal(llvm::GlobalValue *GV, + const NamedDecl *D) const { setGlobalVisibility(GV, D); setDSOLocal(GV); } @@ -1054,25 +1089,6 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) { return getLLVMLinkageForDeclarator(D, Linkage, /*isConstantVariable=*/false); } -void CodeGenModule::setFunctionDLLStorageClass(GlobalDecl GD, llvm::Function *F) { - const auto *FD = cast<FunctionDecl>(GD.getDecl()); - - if (const auto *Dtor = dyn_cast_or_null<CXXDestructorDecl>(FD)) { - if (getCXXABI().useThunkForDtorVariant(Dtor, GD.getDtorType())) { - // Don't dllexport/import destructor thunks. - F->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); - return; - } - } - - if (FD->hasAttr<DLLImportAttr>()) - F->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); - else if (FD->hasAttr<DLLExportAttr>()) - F->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass); - else - F->setDLLStorageClass(llvm::GlobalVariable::DefaultStorageClass); -} - llvm::ConstantInt *CodeGenModule::CreateCrossDsoCfiTypeId(llvm::Metadata *MD) { llvm::MDString *MDS = dyn_cast<llvm::MDString>(MD); if (!MDS) return nullptr; @@ -1234,8 +1250,8 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, void CodeGenModule::SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV) { const Decl *D = GD.getDecl(); - if (const auto *ND = dyn_cast_or_null<NamedDecl>(D)) - setGVProperties(GV, ND); + if (dyn_cast_or_null<NamedDecl>(D)) + setGVProperties(GV, GD); else GV->setVisibility(llvm::GlobalValue::DefaultVisibility); @@ -1243,16 +1259,6 @@ void CodeGenModule::SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV) { addUsedGlobal(GV); } -void CodeGenModule::setAliasAttributes(GlobalDecl GD, llvm::GlobalValue *GV) { - const Decl *D = GD.getDecl(); - SetCommonAttributes(GD, GV); - - // Process the dllexport attribute based on whether the original definition - // (not necessarily the aliasee) was exported. - if (D->hasAttr<DLLExportAttr>()) - GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); -} - bool CodeGenModule::GetCPUAndFeaturesAttributes(const Decl *D, llvm::AttrBuilder &Attrs) { // Add target-cpu and target-features attributes to functions. If @@ -1349,24 +1355,15 @@ void CodeGenModule::SetInternalFunctionAttributes(GlobalDecl GD, setNonAliasAttributes(GD, F); } -static void setLinkageForGV(llvm::GlobalValue *GV, - const NamedDecl *ND) { +static void setLinkageForGV(llvm::GlobalValue *GV, const NamedDecl *ND) { // Set linkage and visibility in case we never see a definition. LinkageInfo LV = ND->getLinkageAndVisibility(); - if (!isExternallyVisible(LV.getLinkage())) { - // Don't set internal linkage on declarations. - } else { - if (ND->hasAttr<DLLImportAttr>()) { - GV->setLinkage(llvm::GlobalValue::ExternalLinkage); - GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); - } else if (ND->hasAttr<DLLExportAttr>()) { - GV->setLinkage(llvm::GlobalValue::ExternalLinkage); - } else if (ND->hasAttr<WeakAttr>() || ND->isWeakImported()) { - // "extern_weak" is overloaded in LLVM; we probably should have - // separate linkage types for this. - GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage); - } - } + // Don't set internal linkage on declarations. + // "extern_weak" is overloaded in LLVM; we probably should have + // separate linkage types for this. + if (isExternallyVisible(LV.getLinkage()) && + (ND->hasAttr<WeakAttr>() || ND->isWeakImported())) + GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage); } void CodeGenModule::CreateFunctionTypeMetadata(const FunctionDecl *FD, @@ -3577,10 +3574,9 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, // declarations). auto *Fn = cast<llvm::Function>(GV); setFunctionLinkage(GD, Fn); - setFunctionDLLStorageClass(GD, Fn); // FIXME: this is redundant with part of setFunctionDefinitionAttributes - setGVProperties(Fn, D); + setGVProperties(Fn, GD); MaybeHandleStaticInExternC(D, Fn); @@ -3672,7 +3668,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { if (VD->getTLSKind()) setTLSMode(GA, *VD); - setAliasAttributes(GD, GA); + SetCommonAttributes(GD, GA); } void CodeGenModule::emitIFuncDefinition(GlobalDecl GD) { diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 29478c5ed89..fbdc4c16921 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -721,11 +721,16 @@ public: /// Set the visibility for the given LLVM GlobalValue. void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const; + void setGlobalVisibilityAndLocal(llvm::GlobalValue *GV, + const NamedDecl *D) const; + void setDSOLocal(llvm::GlobalValue *GV) const; - /// Set visibility and dso_local. + void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const; + void setDLLImportDLLExport(llvm::GlobalValue *GV, const NamedDecl *D) const; + /// Set visibility, dllimport/dllexport and dso_local. /// This must be called after dllimport/dllexport is set. - /// FIXME: should this set dllimport/dllexport instead? + void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const; void setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const; /// Set the TLS mode for the given LLVM GlobalValue for the thread-local @@ -1108,9 +1113,6 @@ public: F->setLinkage(getFunctionLinkage(GD)); } - /// Set the DLL storage class on F. - void setFunctionDLLStorageClass(GlobalDecl GD, llvm::Function *F); - /// Return the appropriate linkage for the vtable, VTT, and type information /// of the given class. llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD); @@ -1190,12 +1192,6 @@ public: /// NOTE: This should only be called for definitions. void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV); - /// Set attributes which must be preserved by an alias. This includes common - /// attributes (i.e. it includes a call to SetCommonAttributes). - /// - /// NOTE: This should only be called for definitions. - void setAliasAttributes(GlobalDecl GD, llvm::GlobalValue *GV); - void addReplacement(StringRef Name, llvm::Constant *C); void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C); diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 6254f359d59..df4a533d46e 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -300,16 +300,11 @@ public: // linkage together with vtables when needed. if (ForVTable && !Thunk->hasLocalLinkage()) Thunk->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); - - // Propagate dllexport storage, to enable the linker to generate import - // thunks as necessary (e.g. when a parent class has a key function and a - // child class doesn't, and the construction vtable for the parent in the - // child needs to reference the parent's thunks). - const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl()); - if (MD->hasAttr<DLLExportAttr>()) - Thunk->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(Thunk, GD); } + bool exportThunk() override { return true; } + llvm::Value *performThisAdjustment(CodeGenFunction &CGF, Address This, const ThisAdjustment &TA) override; @@ -1642,11 +1637,6 @@ llvm::GlobalVariable *ItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, Name, VTableType, llvm::GlobalValue::ExternalLinkage); VTable->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); - if (RD->hasAttr<DLLImportAttr>()) - VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); - else if (RD->hasAttr<DLLExportAttr>()) - VTable->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); - CGM.setGVProperties(VTable, RD); return VTable; @@ -2627,8 +2617,7 @@ ItaniumRTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) { Name); if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) { const CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl()); - if (RD->hasAttr<DLLImportAttr>()) - GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); + CGM.setGVProperties(GV, RD); } } @@ -3637,7 +3626,7 @@ static void emitConstructorDestructorAlias(CodeGenModule &CGM, } // Finally, set up the alias with its proper name and attributes. - CGM.setAliasAttributes(AliasDecl, Alias); + CGM.SetCommonAttributes(AliasDecl, Alias); } void ItaniumCXXABI::emitCXXStructor(const CXXMethodDecl *MD, diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 16bb598fae1..c272891565b 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -357,9 +357,6 @@ public: void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment) override { - // Never dllimport/dllexport thunks. - Thunk->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); - GVALinkage Linkage = getContext().GetGVALinkageForFunction(cast<FunctionDecl>(GD.getDecl())); @@ -371,6 +368,8 @@ public: Thunk->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage); } + bool exportThunk() override { return false; } + llvm::Value *performThisAdjustment(CodeGenFunction &CGF, Address This, const ThisAdjustment &TA) override; @@ -1248,7 +1247,7 @@ void MicrosoftCXXABI::EmitCXXConstructors(const CXXConstructorDecl *D) { if (!hasDefaultCXXMethodCC(getContext(), D) || D->getNumParams() != 0) { llvm::Function *Fn = getAddrOfCXXCtorClosure(D, Ctor_DefaultClosure); Fn->setLinkage(llvm::GlobalValue::WeakODRLinkage); - Fn->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(Fn, D); } } |