summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGRTTI.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-29 22:13:01 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-29 22:13:01 +0000
commitef886958609ad48009e48e054d2172a4a9d9cfe6 (patch)
treea126f83d5a2e9df442e9eb3a0e80e87a041fb69c /clang/lib/CodeGen/CGRTTI.cpp
parent1c6b864abe7afa1faefe5a57b06a7fc16b4e21ab (diff)
downloadbcm5719-llvm-ef886958609ad48009e48e054d2172a4a9d9cfe6.tar.gz
bcm5719-llvm-ef886958609ad48009e48e054d2172a4a9d9cfe6.zip
Handle enum types as well.
llvm-svn: 92276
Diffstat (limited to 'clang/lib/CodeGen/CGRTTI.cpp')
-rw-r--r--clang/lib/CodeGen/CGRTTI.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGRTTI.cpp b/clang/lib/CodeGen/CGRTTI.cpp
index 8680f71cda7..0e3db3a0955 100644
--- a/clang/lib/CodeGen/CGRTTI.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud