diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-11 02:46:30 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-11 02:46:30 +0000 |
commit | 31b7f52d8c8d459e80d2a72176cc7fcc4b7d8d38 (patch) | |
tree | a4499131a47c5cfddfef1e0704e4b5e51f1e8dbc /lib/CodeGen/CGExprCXX.cpp | |
parent | 03981014e4f0c3b4e935872dda96a28c2f1874ea (diff) |
Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 3548669058..ad8734d8da 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -352,18 +352,10 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) { QualType Ty = E->getType(); const llvm::Type *LTy = ConvertType(Ty)->getPointerTo(); - if (E->isTypeOperand()) { - Ty = E->getTypeOperand(); - CanQualType CanTy = CGM.getContext().getCanonicalType(Ty); - Ty = CanTy.getUnqualifiedType().getNonReferenceType(); - if (const RecordType *RT = Ty->getAs<RecordType>()) { - const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); - if (RD->isPolymorphic()) - return Builder.CreateBitCast(CGM.GenerateRTTIRef(RD), LTy); - return Builder.CreateBitCast(CGM.GenerateRTTI(RD), LTy); - } - return Builder.CreateBitCast(CGM.GenerateRTTI(Ty), LTy); - } + + if (E->isTypeOperand()) + return Builder.CreateBitCast(CGM.GetAddrOfRTTI(E->getTypeOperand()), LTy); + Expr *subE = E->getExprOperand(); Ty = subE->getType(); CanQualType CanTy = CGM.getContext().getCanonicalType(Ty); |