[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
thomasanderson updated this revision to Diff 156399. thomasanderson marked 5 inline comments as done. https://reviews.llvm.org/D49109 Files: lib/CodeGen/ItaniumCXXABI.cpp Index: lib/CodeGen/ItaniumCXXABI.cpp === --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -31,6 +31,7 @@ #include "clang/AST/StmtCXX.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" +#include "llvm/IR/GlobalValue.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Value.h" @@ -181,8 +182,7 @@ emitTerminateForUnexpectedException(CodeGenFunction &CGF, llvm::Value *Exn) override; - void EmitFundamentalRTTIDescriptor(QualType Type, bool DLLExport); - void EmitFundamentalRTTIDescriptors(bool DLLExport); + void EmitFundamentalRTTIDescriptors(const CXXRecordDecl *RD); llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override; CatchTypeInfo getAddrOfCXXCatchHandlerType(QualType Ty, @@ -1613,7 +1613,7 @@ isa(DC) && cast(DC)->getIdentifier() && cast(DC)->getIdentifier()->isStr("__cxxabiv1") && DC->getParent()->isTranslationUnit()) -EmitFundamentalRTTIDescriptors(RD->hasAttr()); +EmitFundamentalRTTIDescriptors(RD); if (!VTable->isDeclarationForLinker()) CGM.EmitVTableTypeMetadata(VTable, VTLayout); @@ -2698,12 +2698,16 @@ BCTI_Public = 0x2 }; + /// BuildTypeInfo - Build the RTTI type info struct for the given type, or + /// link to an existing RTTI descriptor if one already exists. + llvm::Constant *BuildTypeInfo(QualType Ty); + /// BuildTypeInfo - Build the RTTI type info struct for the given type. - /// - /// \param Force - true to force the creation of this RTTI value - /// \param DLLExport - true to mark the RTTI value as DLLExport - llvm::Constant *BuildTypeInfo(QualType Ty, bool Force = false, -bool DLLExport = false); + llvm::Constant *BuildTypeInfo( + QualType Ty, + llvm::GlobalVariable::LinkageTypes Linkage, + llvm::GlobalValue::VisibilityTypes Visibility, + llvm::GlobalValue::DLLStorageClassTypes DLLStorageClass); }; } @@ -3172,8 +3176,7 @@ llvm_unreachable("Invalid linkage!"); } -llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force, - bool DLLExport) { +llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty) { // We want to operate on the canonical type. Ty = Ty.getCanonicalType(); @@ -3191,17 +3194,41 @@ } // Check if there is already an external RTTI descriptor for this type. - bool IsStdLib = IsStandardLibraryRTTIDescriptor(Ty); - if (!Force && (IsStdLib || ShouldUseExternalRTTIDescriptor(CGM, Ty))) + if (IsStandardLibraryRTTIDescriptor(Ty) || + ShouldUseExternalRTTIDescriptor(CGM, Ty)) return GetAddrOfExternalRTTIDescriptor(Ty); // Emit the standard library with external linkage. - llvm::GlobalVariable::LinkageTypes Linkage; - if (IsStdLib) -Linkage = llvm::GlobalValue::ExternalLinkage; + llvm::GlobalVariable::LinkageTypes Linkage = getTypeInfoLinkage(CGM, Ty); + + // Give the type_info object and name the formal visibility of the + // type itself. + llvm::GlobalValue::VisibilityTypes llvmVisibility; + if (llvm::GlobalValue::isLocalLinkage(Linkage)) +// If the linkage is local, only default visibility makes sense. +llvmVisibility = llvm::GlobalValue::DefaultVisibility; + else if (CXXABI.classifyRTTIUniqueness(Ty, Linkage) == + ItaniumCXXABI::RUK_NonUniqueHidden) +llvmVisibility = llvm::GlobalValue::HiddenVisibility; else -Linkage = getTypeInfoLinkage(CGM, Ty); +llvmVisibility = CodeGenModule::GetLLVMVisibility(Ty->getVisibility()); + + llvm::GlobalValue::DLLStorageClassTypes DLLStorageClass = + llvm::GlobalValue::DefaultStorageClass; + if (CGM.getTriple().isWindowsItaniumEnvironment()) { +auto RD = Ty->getAsCXXRecordDecl(); +if (RD && RD->hasAttr()) + DLLStorageClass = llvm::GlobalValue::DLLExportStorageClass; + } + return BuildTypeInfo(Ty, Linkage, llvmVisibility, DLLStorageClass); +} + +llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo( + QualType Ty, + llvm::GlobalVariable::LinkageTypes Linkage, + llvm::GlobalValue::VisibilityTypes Visibility, + llvm::GlobalValue::DLLStorageClassTypes DLLStorageClass) { // Add the vtable pointer. BuildVTablePointer(cast(Ty)); @@ -3315,12 +3342,16 @@ llvm::Constant *Init = llvm::ConstantStruct::getAnon(Fields); + SmallString<256> Name; + llvm::raw_svector_ostream Out(Name); + CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out); llvm::Module &M = CGM.getModule(); llvm::GlobalVariable *GV = new llvm::GlobalVariable(M, Init->getType(), /*Constant=*/true, Linkage, Init, Name); // If there's already an old globa
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
thomasanderson created this revision. thomasanderson added a reviewer: pcc. Herald added subscribers: atanasyan, arichardson, sdardis. https://reviews.llvm.org/D49704 Files: test/CodeGen/Mips/dins.ll Index: test/CodeGen/Mips/dins.ll === --- test/CodeGen/Mips/dins.ll +++ test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } Index: test/CodeGen/Mips/dins.ll === --- test/CodeGen/Mips/dins.ll +++ test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
thomasanderson added a comment. pcc ptal I've been granted commit-after-approval, and this is my test CL. https://reviews.llvm.org/D49704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
This revision was automatically updated to reflect the committed changes. Closed by commit rL337771: Fix typo in test/CodeGen/Mips/dins.ll (authored by thomasanderson, committed by ). Herald added subscribers: llvm-commits, jrtc27. Changed prior to commit: https://reviews.llvm.org/D49704?vs=156907&id=156917#toc Repository: rL LLVM https://reviews.llvm.org/D49704 Files: llvm/trunk/test/CodeGen/Mips/dins.ll Index: llvm/trunk/test/CodeGen/Mips/dins.ll === --- llvm/trunk/test/CodeGen/Mips/dins.ll +++ llvm/trunk/test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } Index: llvm/trunk/test/CodeGen/Mips/dins.ll === --- llvm/trunk/test/CodeGen/Mips/dins.ll +++ llvm/trunk/test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
thomasanderson updated this revision to Diff 156943. thomasanderson added a comment. Added test. Also verified that all tests in llvm/tools/clang/test pass. https://reviews.llvm.org/D49109 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/rtti-fundamental.cpp Index: test/CodeGenCXX/rtti-fundamental.cpp === --- test/CodeGenCXX/rtti-fundamental.cpp +++ test/CodeGenCXX/rtti-fundamental.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -fvisibility hidden -o - | FileCheck %s -check-prefix=CHECK-HIDDEN #include @@ -16,116 +17,184 @@ // void // CHECK: @_ZTIv = constant +// CHECK-HIDDEN: @_ZTIv = hidden constant // CHECK: @_ZTIPv = constant +// CHECK-HIDDEN: @_ZTIPv = hidden constant // CHECK: @_ZTIPKv = constant +// CHECK-HIDDEN: @_ZTIPKv = hidden constant // std::nullptr_t // CHECK: @_ZTIDn = constant +// CHECK-HIDDEN: @_ZTIDn = hidden constant // CHECK: @_ZTIPDn = constant +// CHECK-HIDDEN: @_ZTIPDn = hidden constant // CHECK: @_ZTIPKDn = constant +// CHECK-HIDDEN: @_ZTIPKDn = hidden constant // bool // CHECK: @_ZTIb = constant +// CHECK-HIDDEN: @_ZTIb = hidden constant // CHECK: @_ZTIPb = constant +// CHECK-HIDDEN: @_ZTIPb = hidden constant // CHECK: @_ZTIPKb = constant +// CHECK-HIDDEN: @_ZTIPKb = hidden constant // wchar_t // CHECK: @_ZTIw = constant +// CHECK-HIDDEN: @_ZTIw = hidden constant // CHECK: @_ZTIPw = constant +// CHECK-HIDDEN: @_ZTIPw = hidden constant // CHECK: @_ZTIPKw = constant +// CHECK-HIDDEN: @_ZTIPKw = hidden constant // char // CHECK: @_ZTIc = constant +// CHECK-HIDDEN: @_ZTIc = hidden constant // CHECK: @_ZTIPc = constant +// CHECK-HIDDEN: @_ZTIPc = hidden constant // CHECK: @_ZTIPKc = constant +// CHECK-HIDDEN: @_ZTIPKc = hidden constant // unsigned char // CHECK: @_ZTIh = constant +// CHECK-HIDDEN: @_ZTIh = hidden constant // CHECK: @_ZTIPh = constant +// CHECK-HIDDEN: @_ZTIPh = hidden constant // CHECK: @_ZTIPKh = constant +// CHECK-HIDDEN: @_ZTIPKh = hidden constant // signed char // CHECK: @_ZTIa = constant +// CHECK-HIDDEN: @_ZTIa = hidden constant // CHECK: @_ZTIPa = constant +// CHECK-HIDDEN: @_ZTIPa = hidden constant // CHECK: @_ZTIPKa = constant +// CHECK-HIDDEN: @_ZTIPKa = hidden constant // short // CHECK: @_ZTIs = constant +// CHECK-HIDDEN: @_ZTIs = hidden constant // CHECK: @_ZTIPs = constant +// CHECK-HIDDEN: @_ZTIPs = hidden constant // CHECK: @_ZTIPKs = constant +// CHECK-HIDDEN: @_ZTIPKs = hidden constant // unsigned short // CHECK: @_ZTIt = constant +// CHECK-HIDDEN: @_ZTIt = hidden constant // CHECK: @_ZTIPt = constant +// CHECK-HIDDEN: @_ZTIPt = hidden constant // CHECK: @_ZTIPKt = constant +// CHECK-HIDDEN: @_ZTIPKt = hidden constant // int // CHECK: @_ZTIi = constant +// CHECK-HIDDEN: @_ZTIi = hidden constant // CHECK: @_ZTIPi = constant +// CHECK-HIDDEN: @_ZTIPi = hidden constant // CHECK: @_ZTIPKi = constant +// CHECK-HIDDEN: @_ZTIPKi = hidden constant // unsigned int // CHECK: @_ZTIj = constant +// CHECK-HIDDEN: @_ZTIj = hidden constant // CHECK: @_ZTIPj = constant +// CHECK-HIDDEN: @_ZTIPj = hidden constant // CHECK: @_ZTIPKj = constant +// CHECK-HIDDEN: @_ZTIPKj = hidden constant // long // CHECK: @_ZTIl = constant +// CHECK-HIDDEN: @_ZTIl = hidden constant // CHECK: @_ZTIPl = constant +// CHECK-HIDDEN: @_ZTIPl = hidden constant // CHECK: @_ZTIPKl = constant +// CHECK-HIDDEN: @_ZTIPKl = hidden constant // unsigned long // CHECK: @_ZTIm = constant +// CHECK-HIDDEN: @_ZTIm = hidden constant // CHECK: @_ZTIPm = constant +// CHECK-HIDDEN: @_ZTIPm = hidden constant // CHECK: @_ZTIPKm = constant +// CHECK-HIDDEN: @_ZTIPKm = hidden constant // long long // CHECK: @_ZTIx = constant +// CHECK-HIDDEN: @_ZTIx = hidden constant // CHECK: @_ZTIPx = constant +// CHECK-HIDDEN: @_ZTIPx = hidden constant // CHECK: @_ZTIPKx = constant +// CHECK-HIDDEN: @_ZTIPKx = hidden constant // unsigned long long // CHECK: @_ZTIy = constant +// CHECK-HIDDEN: @_ZTIy = hidden constant // CHECK: @_ZTIPy = constant +// CHECK-HIDDEN: @_ZTIPy = hidden constant // CHECK: @_ZTIPKy = constant +// CHECK-HIDDEN: @_ZTIPKy = hidden constant // __int128 // CHECK: @_ZTIn = constant +// CHECK-HIDDEN: @_ZTIn = hidden constant // CHECK: @_ZTIPn = constant +// CHECK-HIDDEN: @_ZTIPn = hidden constant // CHECK: @_ZTIPKn = constant +// CHECK-HIDDEN: @_ZTIPKn = hidden constant // unsigned __int128 // CHECK: @_ZTIo = constant +// CHECK-HIDDEN: @_ZTIo = hidden constant // CHECK: @_ZTIPo = constant +// CHECK-HIDDEN: @_ZTIPo = hidden constant // CHECK: @_ZTIPKo = constant +// CHECK-HIDDEN: @_ZTIPKo = hidden constant // half // CHECK: @_ZTIDh = constant +// CHECK-HIDDEN: @_ZTIDh = hidden constant // CHECK: @_ZTIPDh = constant +// CHECK-HIDDEN: @_ZTIPDh = hidden constant // CHECK: @_ZTIPKDh = constant +/
[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
This revision was automatically updated to reflect the committed changes. Closed by commit rC337788: Borrow visibility from __fundamental_type_info for generated fundamental type… (authored by thomasanderson, committed by ). Repository: rC Clang https://reviews.llvm.org/D49109 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/rtti-fundamental.cpp Index: test/CodeGenCXX/rtti-fundamental.cpp === --- test/CodeGenCXX/rtti-fundamental.cpp +++ test/CodeGenCXX/rtti-fundamental.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -fvisibility hidden -o - | FileCheck %s -check-prefix=CHECK-HIDDEN #include @@ -16,116 +17,184 @@ // void // CHECK: @_ZTIv = constant +// CHECK-HIDDEN: @_ZTIv = hidden constant // CHECK: @_ZTIPv = constant +// CHECK-HIDDEN: @_ZTIPv = hidden constant // CHECK: @_ZTIPKv = constant +// CHECK-HIDDEN: @_ZTIPKv = hidden constant // std::nullptr_t // CHECK: @_ZTIDn = constant +// CHECK-HIDDEN: @_ZTIDn = hidden constant // CHECK: @_ZTIPDn = constant +// CHECK-HIDDEN: @_ZTIPDn = hidden constant // CHECK: @_ZTIPKDn = constant +// CHECK-HIDDEN: @_ZTIPKDn = hidden constant // bool // CHECK: @_ZTIb = constant +// CHECK-HIDDEN: @_ZTIb = hidden constant // CHECK: @_ZTIPb = constant +// CHECK-HIDDEN: @_ZTIPb = hidden constant // CHECK: @_ZTIPKb = constant +// CHECK-HIDDEN: @_ZTIPKb = hidden constant // wchar_t // CHECK: @_ZTIw = constant +// CHECK-HIDDEN: @_ZTIw = hidden constant // CHECK: @_ZTIPw = constant +// CHECK-HIDDEN: @_ZTIPw = hidden constant // CHECK: @_ZTIPKw = constant +// CHECK-HIDDEN: @_ZTIPKw = hidden constant // char // CHECK: @_ZTIc = constant +// CHECK-HIDDEN: @_ZTIc = hidden constant // CHECK: @_ZTIPc = constant +// CHECK-HIDDEN: @_ZTIPc = hidden constant // CHECK: @_ZTIPKc = constant +// CHECK-HIDDEN: @_ZTIPKc = hidden constant // unsigned char // CHECK: @_ZTIh = constant +// CHECK-HIDDEN: @_ZTIh = hidden constant // CHECK: @_ZTIPh = constant +// CHECK-HIDDEN: @_ZTIPh = hidden constant // CHECK: @_ZTIPKh = constant +// CHECK-HIDDEN: @_ZTIPKh = hidden constant // signed char // CHECK: @_ZTIa = constant +// CHECK-HIDDEN: @_ZTIa = hidden constant // CHECK: @_ZTIPa = constant +// CHECK-HIDDEN: @_ZTIPa = hidden constant // CHECK: @_ZTIPKa = constant +// CHECK-HIDDEN: @_ZTIPKa = hidden constant // short // CHECK: @_ZTIs = constant +// CHECK-HIDDEN: @_ZTIs = hidden constant // CHECK: @_ZTIPs = constant +// CHECK-HIDDEN: @_ZTIPs = hidden constant // CHECK: @_ZTIPKs = constant +// CHECK-HIDDEN: @_ZTIPKs = hidden constant // unsigned short // CHECK: @_ZTIt = constant +// CHECK-HIDDEN: @_ZTIt = hidden constant // CHECK: @_ZTIPt = constant +// CHECK-HIDDEN: @_ZTIPt = hidden constant // CHECK: @_ZTIPKt = constant +// CHECK-HIDDEN: @_ZTIPKt = hidden constant // int // CHECK: @_ZTIi = constant +// CHECK-HIDDEN: @_ZTIi = hidden constant // CHECK: @_ZTIPi = constant +// CHECK-HIDDEN: @_ZTIPi = hidden constant // CHECK: @_ZTIPKi = constant +// CHECK-HIDDEN: @_ZTIPKi = hidden constant // unsigned int // CHECK: @_ZTIj = constant +// CHECK-HIDDEN: @_ZTIj = hidden constant // CHECK: @_ZTIPj = constant +// CHECK-HIDDEN: @_ZTIPj = hidden constant // CHECK: @_ZTIPKj = constant +// CHECK-HIDDEN: @_ZTIPKj = hidden constant // long // CHECK: @_ZTIl = constant +// CHECK-HIDDEN: @_ZTIl = hidden constant // CHECK: @_ZTIPl = constant +// CHECK-HIDDEN: @_ZTIPl = hidden constant // CHECK: @_ZTIPKl = constant +// CHECK-HIDDEN: @_ZTIPKl = hidden constant // unsigned long // CHECK: @_ZTIm = constant +// CHECK-HIDDEN: @_ZTIm = hidden constant // CHECK: @_ZTIPm = constant +// CHECK-HIDDEN: @_ZTIPm = hidden constant // CHECK: @_ZTIPKm = constant +// CHECK-HIDDEN: @_ZTIPKm = hidden constant // long long // CHECK: @_ZTIx = constant +// CHECK-HIDDEN: @_ZTIx = hidden constant // CHECK: @_ZTIPx = constant +// CHECK-HIDDEN: @_ZTIPx = hidden constant // CHECK: @_ZTIPKx = constant +// CHECK-HIDDEN: @_ZTIPKx = hidden constant // unsigned long long // CHECK: @_ZTIy = constant +// CHECK-HIDDEN: @_ZTIy = hidden constant // CHECK: @_ZTIPy = constant +// CHECK-HIDDEN: @_ZTIPy = hidden constant // CHECK: @_ZTIPKy = constant +// CHECK-HIDDEN: @_ZTIPKy = hidden constant // __int128 // CHECK: @_ZTIn = constant +// CHECK-HIDDEN: @_ZTIn = hidden constant // CHECK: @_ZTIPn = constant +// CHECK-HIDDEN: @_ZTIPn = hidden constant // CHECK: @_ZTIPKn = constant +// CHECK-HIDDEN: @_ZTIPKn = hidden constant // unsigned __int128 // CHECK: @_ZTIo = constant +// CHECK-HIDDEN: @_ZTIo = hidden constant // CHECK: @_ZTIPo = constant +// CHECK-HIDDEN: @_ZTIPo = hidden constant // CHECK: @_ZTIPKo = constant +// CHECK-HIDDEN: @_ZTIPKo = hidden constant // half // CHECK: @_ZTIDh = constant +// CHECK-HIDDEN: @_ZTIDh = hidden constant // CHECK: @_ZTIPDh
[PATCH] D49745: Generate fundamental type info with weak linkage
thomasanderson created this revision. thomasanderson added a reviewer: pcc. https://reviews.llvm.org/D49745 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/rtti-fundamental.cpp test/CodeGenCXX/windows-itanium-type-info.cpp Index: test/CodeGenCXX/windows-itanium-type-info.cpp === --- test/CodeGenCXX/windows-itanium-type-info.cpp +++ test/CodeGenCXX/windows-itanium-type-info.cpp @@ -24,8 +24,8 @@ throw base(); } -// CHECK-DAG: @_ZTIi = dso_local dllexport constant -// CHECK-DAG: @_ZTSi = dso_local dllexport constant +// CHECK-DAG: @_ZTIi = extern_weak dso_local dllexport constant +// CHECK-DAG: @_ZTSi = extern_weak dso_local dllexport constant // CHECK-DAG: @_ZTI7derived = dso_local dllexport constant // CHECK-DAG: @_ZTS7derived = dso_local dllexport constant Index: test/CodeGenCXX/rtti-fundamental.cpp === --- test/CodeGenCXX/rtti-fundamental.cpp +++ test/CodeGenCXX/rtti-fundamental.cpp @@ -16,185 +16,185 @@ } // void -// CHECK: @_ZTIv = constant -// CHECK-HIDDEN: @_ZTIv = hidden constant -// CHECK: @_ZTIPv = constant -// CHECK-HIDDEN: @_ZTIPv = hidden constant -// CHECK: @_ZTIPKv = constant -// CHECK-HIDDEN: @_ZTIPKv = hidden constant +// CHECK: @_ZTIv = extern_weak constant +// CHECK-HIDDEN: @_ZTIv = extern_weak hidden constant +// CHECK: @_ZTIPv = extern_weak constant +// CHECK-HIDDEN: @_ZTIPv = extern_weak hidden constant +// CHECK: @_ZTIPKv = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKv = extern_weak hidden constant // std::nullptr_t -// CHECK: @_ZTIDn = constant -// CHECK-HIDDEN: @_ZTIDn = hidden constant -// CHECK: @_ZTIPDn = constant -// CHECK-HIDDEN: @_ZTIPDn = hidden constant -// CHECK: @_ZTIPKDn = constant -// CHECK-HIDDEN: @_ZTIPKDn = hidden constant +// CHECK: @_ZTIDn = extern_weak constant +// CHECK-HIDDEN: @_ZTIDn = extern_weak hidden constant +// CHECK: @_ZTIPDn = extern_weak constant +// CHECK-HIDDEN: @_ZTIPDn = extern_weak hidden constant +// CHECK: @_ZTIPKDn = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKDn = extern_weak hidden constant // bool -// CHECK: @_ZTIb = constant -// CHECK-HIDDEN: @_ZTIb = hidden constant -// CHECK: @_ZTIPb = constant -// CHECK-HIDDEN: @_ZTIPb = hidden constant -// CHECK: @_ZTIPKb = constant -// CHECK-HIDDEN: @_ZTIPKb = hidden constant +// CHECK: @_ZTIb = extern_weak constant +// CHECK-HIDDEN: @_ZTIb = extern_weak hidden constant +// CHECK: @_ZTIPb = extern_weak constant +// CHECK-HIDDEN: @_ZTIPb = extern_weak hidden constant +// CHECK: @_ZTIPKb = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKb = extern_weak hidden constant // wchar_t -// CHECK: @_ZTIw = constant -// CHECK-HIDDEN: @_ZTIw = hidden constant -// CHECK: @_ZTIPw = constant -// CHECK-HIDDEN: @_ZTIPw = hidden constant -// CHECK: @_ZTIPKw = constant -// CHECK-HIDDEN: @_ZTIPKw = hidden constant +// CHECK: @_ZTIw = extern_weak constant +// CHECK-HIDDEN: @_ZTIw = extern_weak hidden constant +// CHECK: @_ZTIPw = extern_weak constant +// CHECK-HIDDEN: @_ZTIPw = extern_weak hidden constant +// CHECK: @_ZTIPKw = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKw = extern_weak hidden constant // char -// CHECK: @_ZTIc = constant -// CHECK-HIDDEN: @_ZTIc = hidden constant -// CHECK: @_ZTIPc = constant -// CHECK-HIDDEN: @_ZTIPc = hidden constant -// CHECK: @_ZTIPKc = constant -// CHECK-HIDDEN: @_ZTIPKc = hidden constant +// CHECK: @_ZTIc = extern_weak constant +// CHECK-HIDDEN: @_ZTIc = extern_weak hidden constant +// CHECK: @_ZTIPc = extern_weak constant +// CHECK-HIDDEN: @_ZTIPc = extern_weak hidden constant +// CHECK: @_ZTIPKc = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKc = extern_weak hidden constant // unsigned char -// CHECK: @_ZTIh = constant -// CHECK-HIDDEN: @_ZTIh = hidden constant -// CHECK: @_ZTIPh = constant -// CHECK-HIDDEN: @_ZTIPh = hidden constant -// CHECK: @_ZTIPKh = constant -// CHECK-HIDDEN: @_ZTIPKh = hidden constant +// CHECK: @_ZTIh = extern_weak constant +// CHECK-HIDDEN: @_ZTIh = extern_weak hidden constant +// CHECK: @_ZTIPh = extern_weak constant +// CHECK-HIDDEN: @_ZTIPh = extern_weak hidden constant +// CHECK: @_ZTIPKh = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKh = extern_weak hidden constant // signed char -// CHECK: @_ZTIa = constant -// CHECK-HIDDEN: @_ZTIa = hidden constant -// CHECK: @_ZTIPa = constant -// CHECK-HIDDEN: @_ZTIPa = hidden constant -// CHECK: @_ZTIPKa = constant -// CHECK-HIDDEN: @_ZTIPKa = hidden constant +// CHECK: @_ZTIa = extern_weak constant +// CHECK-HIDDEN: @_ZTIa = extern_weak hidden constant +// CHECK: @_ZTIPa = extern_weak constant +// CHECK-HIDDEN: @_ZTIPa = extern_weak hidden constant +// CHECK: @_ZTIPKa = extern_weak constant +// CHECK-HIDDEN: @_ZTIPKa = extern_weak hidden constant // short -// CHECK: @_ZTIs = constant -// CHECK-HIDDEN: @_ZTIs = hidden constant -// CHECK: @_ZTIPs = constant -// CHECK-HIDDEN: @_ZTIPs = hidden constant -// CHECK: @_ZTIPKs = constant -// C
[PATCH] D35388: [libc++] Give extern templates default visibility on gcc
thomasanderson added a comment. In https://reviews.llvm.org/D35388#1167305, @ldionne wrote: > ABI-wise, I think this change is OK. Indeed, if `__type_visibility__` is not > supported, we're already marking the base template as > `__visibility__("default")`, so marking the extern template declaration with > `__visibility__("default")` is not a problem. If `__type_visibility__` is > supported, then there's no change in behavior. So I think there is no change > in behavior either way, and I'm actually wondering why @thomasanderson wants > this change in if the behavior is always the same. Perhaps I am missing > something? It's been a while, but IIRC this fixes the Chromium build with gcc and libc++, since std::vector_base_common::__throw_length_error() wasn't getting exported otherwise. See the comment in the Chromium source code: https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/BUILD.gn?rcl=0dd5c6f980d22be96b728155249df2da355989d9&l=88 And also this CL https://reviews.llvm.org/D35326 > As a diversion, I'm confused by the very fact that we need to apply > `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` to the _extern template declaration_. I > would have expected instead that, if anything, we need to specify the > visibility on the _explicit instantiation_ in the dylib. https://reviews.llvm.org/D35388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35388: [libc++] Give extern templates default visibility on gcc
thomasanderson added a comment. Friendly ping for @EricWF https://reviews.llvm.org/D35388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35388: [libc++] Give extern templates default visibility on gcc
thomasanderson added a comment. Hm.. is there anyone else who might be able to review? https://reviews.llvm.org/D35388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35388: [libc++] Give extern templates default visibility on gcc
thomasanderson added a comment. We appear to still be carrying a patch for this in Chromium, so I think the issue still stands. https://source.chromium.org/chromium/chromium/src/+/master:buildtools/third_party/libc++/BUILD.gn;drc=21272efa27e69622c6d174f29e4a73f1a6088cfc;l=135 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D35388/new/ https://reviews.llvm.org/D35388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits