aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRtti.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-11-20 00:31:50 +0000
committerMike Stump <mrs@apple.com>2009-11-20 00:31:50 +0000
commit7e1365a163cde50b1972f05db7884fb124e6b2d7 (patch)
tree88b590268b073441263034366b2215055c02bd7a /lib/CodeGen/CGRtti.cpp
parent71a5e2841d7a6f3f77230970a7d15bd2cb9e118e (diff)
Simplify rtti building code a little. Prep for reuse for throw rtti
generation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRtti.cpp')
-rw-r--r--lib/CodeGen/CGRtti.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/CodeGen/CGRtti.cpp b/lib/CodeGen/CGRtti.cpp
index 79d866427f..38a17b3c39 100644
--- a/lib/CodeGen/CGRtti.cpp
+++ b/lib/CodeGen/CGRtti.cpp
@@ -260,13 +260,6 @@ public:
return llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), f);
}
- llvm::Constant *BuildType2(QualType Ty) {
- if (const RecordType *RT = Ty.getTypePtr()->getAs<RecordType>())
- if (const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()))
- return Buildclass_type_info(RD);
- return BuildType(Ty);
- }
-
bool DecideExtern(QualType Ty) {
// For this type, see if all components are never in an anonymous namespace.
if (const MemberPointerType *MPT = Ty->getAs<MemberPointerType>())
@@ -338,10 +331,10 @@ public:
info.push_back(BuildInt(flags));
info.push_back(BuildInt(0));
- info.push_back(BuildType2(PTy));
+ info.push_back(BuildType(PTy));
if (PtrMem)
- info.push_back(BuildType2(BTy));
+ info.push_back(BuildType(BTy));
// We always generate these as hidden, only the name isn't hidden.
return finish(info, GV, Name, true, Extern);
@@ -376,6 +369,11 @@ public:
llvm::Constant *BuildType(QualType Ty) {
const clang::Type &Type
= *CGM.getContext().getCanonicalType(Ty).getTypePtr();
+
+ if (const RecordType *RT = Ty.getTypePtr()->getAs<RecordType>())
+ if (const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()))
+ return Buildclass_type_info(RD);
+
switch (Type.getTypeClass()) {
default: {
assert(0 && "typeid expression");
@@ -426,7 +424,7 @@ llvm::Constant *CodeGenModule::GenerateRtti(const CXXRecordDecl *RD) {
return b.Buildclass_type_info(RD);
}
-llvm::Constant *CodeGenModule::GenerateRttiNonClass(QualType Ty) {
+llvm::Constant *CodeGenModule::GenerateRtti(QualType Ty) {
RttiBuilder b(*this);
return b.BuildType(Ty);