diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-29 22:13:01 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-29 22:13:01 +0000 |
commit | 9c7b6bb952672b9d184a4426138579d55c370afc (patch) | |
tree | 5c829860aa2331e2afe0129594b32fb6cb9a72d4 /lib/CodeGen/CGRTTI.cpp | |
parent | 978ef68bc4cde1448a1f6c8ab0e20543cec1a486 (diff) |
Handle enum types as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRTTI.cpp')
-rw-r--r-- | lib/CodeGen/CGRTTI.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp index 8680f71cda..0e3db3a095 100644 --- a/lib/CodeGen/CGRTTI.cpp +++ b/lib/CodeGen/CGRTTI.cpp @@ -370,13 +370,12 @@ public: case Type::ConstantArray: case Type::IncompleteArray: case Type::VariableArray: + case Type::Enum: return BuildTypeInfo(Ty); case Type::Vector: case Type::ExtVector: return BuildSimpleType(Ty, "_ZTVN10__cxxabiv117__array_type_infoE"); - case Type::Enum: - return BuildSimpleType(Ty, "_ZTVN10__cxxabiv116__enum_type_infoE"); } } @@ -614,7 +613,17 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(QualType Ty) { return llvm::GlobalVariable::InternalLinkage; return llvm::GlobalVariable::WeakODRLinkage; - break; + } + + case Type::Enum: { + const EnumType *EnumTy = cast<EnumType>(Ty); + const EnumDecl *ED = EnumTy->getDecl(); + + // If we're in an anonymous namespace, then we always want internal linkage. + if (ED->isInAnonymousNamespace() || !ED->hasLinkage()) + return llvm::GlobalVariable::InternalLinkage; + + return llvm::GlobalValue::WeakODRLinkage; } case Type::Record: { @@ -694,6 +703,11 @@ void RTTIBuilder::BuildVtablePointer(const Type *Ty) { VtableName = "_ZTVN10__cxxabiv120__function_type_infoE"; break; + case Type::Enum: + // abi::__enum_type_info + VtableName = "_ZTVN10__cxxabiv116__enum_type_infoE"; + break; + case Type::Record: { const CXXRecordDecl *RD = cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl()); @@ -772,6 +786,11 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty) { // abi::__function_type_info adds no data members to std::type_info; break; + case Type::Enum: + // Itanium C++ ABI 2.9.5p4: + // abi::__enum_type_info adds no data members to std::type_info; + break; + case Type::Record: { const CXXRecordDecl *RD = cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl()); |