]> granicus.if.org Git - clang/commitdiff
Simplify typeid 'potentially evaluated' check.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 27 Dec 2012 15:26:27 +0000 (15:26 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 27 Dec 2012 15:26:27 +0000 (15:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171162 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/EvaluatedExprVisitor.h

index 03138a15bd2d4783beac0e812ee43d7f8a33e7da..62c35990b3d3973d0a15f9babf2afd987cacff8f 100644 (file)
@@ -60,13 +60,8 @@ public:
   }
   
   void VisitCXXTypeidExpr(CXXTypeidExpr *E) {
-    // typeid(expression) is potentially evaluated when the argument is
-    // a glvalue of polymorphic type. (C++ 5.2.8p2-3)
-    if (!E->isTypeOperand() && E->Classify(Context).isGLValue())
-      if (const RecordType *Record 
-                 = E->getExprOperand()->getType()->template getAs<RecordType>())
-        if (cast<CXXRecordDecl>(Record->getDecl())->isPolymorphic())
-          return this->Visit(E->getExprOperand());
+    if (E->isPotentiallyEvaluated())
+      return this->Visit(E->getExprOperand());
   }
   
   /// \brief The basis case walks all of the children of the statement or