aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXXExpr.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-11-17 02:16:21 +0000
committerMike Stump <mrs@apple.com>2009-11-17 02:16:21 +0000
commitea2c0b5dec07c28222856e66177f0922c9f508b1 (patch)
tree393c9976d660328c2d79e4cb9595c02fca242353 /lib/CodeGen/CGCXXExpr.cpp
parenta24dc2e38c7fb0f7f138b3d14b5f0f241fd0eccf (diff)
Add typeid for the builtin types. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXXExpr.cpp')
-rw-r--r--lib/CodeGen/CGCXXExpr.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/CodeGen/CGCXXExpr.cpp b/lib/CodeGen/CGCXXExpr.cpp
index 75740af074..71ddca7eec 100644
--- a/lib/CodeGen/CGCXXExpr.cpp
+++ b/lib/CodeGen/CGCXXExpr.cpp
@@ -347,7 +347,7 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
QualType Ty = E->getType();
const llvm::Type *LTy = ConvertType(Ty)->getPointerTo();
if (E->isTypeOperand()) {
- QualType Ty = E->getTypeOperand();
+ Ty = E->getTypeOperand();
CanQualType CanTy = CGM.getContext().getCanonicalType(Ty);
Ty = CanTy.getUnqualifiedType().getNonReferenceType();
if (const RecordType *RT = Ty->getAs<RecordType>()) {
@@ -356,9 +356,7 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
return Builder.CreateBitCast(CGM.GenerateRttiRef(RD), LTy);
return Builder.CreateBitCast(CGM.GenerateRtti(RD), LTy);
}
- // FIXME: return the rtti for the non-class static type.
- ErrorUnsupported(E, "typeid expression");
- return 0;
+ return Builder.CreateBitCast(CGM.GenerateRttiNonClass(Ty), LTy);
}
Expr *subE = E->getExprOperand();
if (const RecordType *RT = Ty->getAs<RecordType>()) {
@@ -397,11 +395,12 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
V = Builder.CreateLoad(V);
return V;
}
- return CGM.GenerateRtti(RD);
+ return Builder.CreateBitCast(CGM.GenerateRtti(RD), LTy);
}
- // FIXME: return rtti for the non-class static type.
- ErrorUnsupported(E, "typeid expression");
- return 0;
+ Ty = subE->getType();
+ CanQualType CanTy = CGM.getContext().getCanonicalType(Ty);
+ Ty = CanTy.getUnqualifiedType().getNonReferenceType();
+ return Builder.CreateBitCast(CGM.GenerateRttiNonClass(Ty), LTy);
}
llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,