summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-13 20:08:14 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-13 20:08:14 +0000
commitef8bf4368ec62eac1948f2c5c0f05f672d4fe1b1 (patch)
treec2be4f93512a27fd933c2fe16430a61887359856 /clang/lib/CodeGen/CGExprCXX.cpp
parent0bb7f23cfc9b7b27d45c6f3c4f75dd5850f98dbb (diff)
downloadbcm5719-llvm-ef8bf4368ec62eac1948f2c5c0f05f672d4fe1b1.tar.gz
bcm5719-llvm-ef8bf4368ec62eac1948f2c5c0f05f672d4fe1b1.zip
Factor out computation of whether a typeid's expression is potentially
evaluated into a CXXTypeid member function. No functionality change. llvm-svn: 161779
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 79ebe515b0e..7c2c9f1ecb4 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1643,15 +1643,9 @@ llvm::Value *CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
// polymorphic class type, the result refers to a std::type_info object
// representing the type of the most derived object (that is, the dynamic
// type) to which the glvalue refers.
- if (E->getExprOperand()->isGLValue()) {
- if (const RecordType *RT =
- E->getExprOperand()->getType()->getAs<RecordType>()) {
- const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
- if (RD->isPolymorphic())
- return EmitTypeidFromVTable(*this, E->getExprOperand(),
- StdTypeInfoPtrTy);
- }
- }
+ if (E->isPotentiallyEvaluated())
+ return EmitTypeidFromVTable(*this, E->getExprOperand(),
+ StdTypeInfoPtrTy);
QualType OperandTy = E->getExprOperand()->getType();
return Builder.CreateBitCast(CGM.GetAddrOfRTTIDescriptor(OperandTy),
OpenPOWER on IntegriCloud