diff options
Diffstat (limited to 'include/clang/AST/EvaluatedExprVisitor.h')
-rw-r--r-- | include/clang/AST/EvaluatedExprVisitor.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/include/clang/AST/EvaluatedExprVisitor.h b/include/clang/AST/EvaluatedExprVisitor.h index d5e9c8c..eb186c2 100644 --- a/include/clang/AST/EvaluatedExprVisitor.h +++ b/include/clang/AST/EvaluatedExprVisitor.h @@ -15,10 +15,10 @@ #ifndef LLVM_CLANG_AST_EVALUATEDEXPRVISITOR_H #define LLVM_CLANG_AST_EVALUATEDEXPRVISITOR_H -#include "clang/AST/StmtVisitor.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" +#include "clang/AST/StmtVisitor.h" namespace clang { @@ -49,6 +49,9 @@ public: } void VisitChooseExpr(ChooseExpr *E) { + // Don't visit either child expression if the condition is dependent. + if (E->getCond()->isValueDependent()) + return; // Only the selected subexpression matters; the other one is not evaluated. return this->Visit(E->getChosenSubExpr(Context)); } @@ -58,17 +61,17 @@ public: // expressions. return this->Visit(E->getInit()); } - + 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()); } - + + void VisitCallExpr(CallExpr *CE) { + if (!CE->isUnevaluatedBuiltinCall(Context)) + return static_cast<ImplClass*>(this)->VisitExpr(CE); + } + /// \brief The basis case walks all of the children of the statement or /// expression, assuming they are all potentially evaluated. void VisitStmt(Stmt *S) { |