From 0680f97fc4904c486a8b6a66928b329d3d7cd65c Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 31 Oct 2018 03:48:47 +0000 Subject: Create ConstantExpr class A ConstantExpr class represents a full expression that's in a context where a constant expression is required. This class reflects the path the evaluator took to reach the expression rather than the syntactic context in which the expression occurs. In the future, the class will be expanded to cache the result of the evaluated expression so that it's not needlessly re-evaluated Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D53475 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345692 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ARCMigrate/TransAutoreleasePool.cpp | 4 ++-- lib/ARCMigrate/TransRetainReleaseDealloc.cpp | 6 +++--- lib/ARCMigrate/TransUnbridgedCasts.cpp | 2 +- lib/ARCMigrate/Transforms.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/ARCMigrate') diff --git a/lib/ARCMigrate/TransAutoreleasePool.cpp b/lib/ARCMigrate/TransAutoreleasePool.cpp index 1acf63cc2b..9d20774a89 100644 --- a/lib/ARCMigrate/TransAutoreleasePool.cpp +++ b/lib/ARCMigrate/TransAutoreleasePool.cpp @@ -403,8 +403,8 @@ private: return cast(getEssential((Stmt*)E)); } static Stmt *getEssential(Stmt *S) { - if (ExprWithCleanups *EWC = dyn_cast(S)) - S = EWC->getSubExpr(); + if (FullExpr *FE = dyn_cast(S)) + S = FE->getSubExpr(); if (Expr *E = dyn_cast(S)) S = E->IgnoreParenCasts(); return S; diff --git a/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/lib/ARCMigrate/TransRetainReleaseDealloc.cpp index f2aceaa795..f0987786d4 100644 --- a/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ b/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -253,7 +253,7 @@ private: } while (OuterS && (isa(OuterS) || isa(OuterS) || - isa(OuterS))); + isa(OuterS))); if (!OuterS) return std::make_pair(prevStmt, nextStmt); @@ -376,8 +376,8 @@ private: RecContainer = StmtE; Rec = Init->IgnoreParenImpCasts(); - if (ExprWithCleanups *EWC = dyn_cast(Rec)) - Rec = EWC->getSubExpr()->IgnoreParenImpCasts(); + if (FullExpr *FE = dyn_cast(Rec)) + Rec = FE->getSubExpr()->IgnoreParenImpCasts(); RecRange = Rec->getSourceRange(); if (SM.isMacroArgExpansion(RecRange.getBegin())) RecRange.setBegin(SM.getImmediateSpellingLoc(RecRange.getBegin())); diff --git a/lib/ARCMigrate/TransUnbridgedCasts.cpp b/lib/ARCMigrate/TransUnbridgedCasts.cpp index 631eceb03f..9d46d8c5fc 100644 --- a/lib/ARCMigrate/TransUnbridgedCasts.cpp +++ b/lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -372,7 +372,7 @@ private: Stmt *parent = E; do { parent = StmtMap->getParentIgnoreParenImpCasts(parent); - } while (parent && isa(parent)); + } while (parent && isa(parent)); if (ReturnStmt *retS = dyn_cast_or_null(parent)) { std::string note = "remove the cast and change return type of function " diff --git a/lib/ARCMigrate/Transforms.cpp b/lib/ARCMigrate/Transforms.cpp index a403744de7..8bd2b407ae 100644 --- a/lib/ARCMigrate/Transforms.cpp +++ b/lib/ARCMigrate/Transforms.cpp @@ -74,8 +74,8 @@ bool trans::isPlusOneAssign(const BinaryOperator *E) { bool trans::isPlusOne(const Expr *E) { if (!E) return false; - if (const ExprWithCleanups *EWC = dyn_cast(E)) - E = EWC->getSubExpr(); + if (const FullExpr *FE = dyn_cast(E)) + E = FE->getSubExpr(); if (const ObjCMessageExpr * ME = dyn_cast(E->IgnoreParenCasts())) -- cgit v1.2.3