aboutsummaryrefslogtreecommitdiff
path: root/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
commit0d729105ecb50a7e3cbe6e57c29149edfa5cf05a (patch)
tree8c4f1bc2fdc5e9cbbc8a853c152f440f642276b5 /lib/CodeGen/CGExprCXX.cpp
parent37f7a3326791dd625a4aa9a097b5fad0a757c956 (diff)
Factor out computation of whether a typeid's expression is potentially
evaluated into a CXXTypeid member function. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--lib/CodeGen/CGExprCXX.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index 79ebe515b0..7c2c9f1ecb 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/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),