diff options
author | Bill Wendling <isanbard@gmail.com> | 2018-10-31 03:48:47 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2018-10-31 03:48:47 +0000 |
commit | 0680f97fc4904c486a8b6a66928b329d3d7cd65c (patch) | |
tree | 2bd642a2abfaa066932a214bd1176e4f56afb6aa /lib/ARCMigrate | |
parent | 3b778bc3cec73f904457d70d6f956e1aafe1b550 (diff) |
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
Diffstat (limited to 'lib/ARCMigrate')
-rw-r--r-- | lib/ARCMigrate/TransAutoreleasePool.cpp | 4 | ||||
-rw-r--r-- | lib/ARCMigrate/TransRetainReleaseDealloc.cpp | 6 | ||||
-rw-r--r-- | lib/ARCMigrate/TransUnbridgedCasts.cpp | 2 | ||||
-rw-r--r-- | lib/ARCMigrate/Transforms.cpp | 4 |
4 files changed, 8 insertions, 8 deletions
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<Expr>(getEssential((Stmt*)E)); } static Stmt *getEssential(Stmt *S) { - if (ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(S)) - S = EWC->getSubExpr(); + if (FullExpr *FE = dyn_cast<FullExpr>(S)) + S = FE->getSubExpr(); if (Expr *E = dyn_cast<Expr>(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<ParenExpr>(OuterS) || isa<CastExpr>(OuterS) || - isa<ExprWithCleanups>(OuterS))); + isa<FullExpr>(OuterS))); if (!OuterS) return std::make_pair(prevStmt, nextStmt); @@ -376,8 +376,8 @@ private: RecContainer = StmtE; Rec = Init->IgnoreParenImpCasts(); - if (ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(Rec)) - Rec = EWC->getSubExpr()->IgnoreParenImpCasts(); + if (FullExpr *FE = dyn_cast<FullExpr>(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<ExprWithCleanups>(parent)); + } while (parent && isa<FullExpr>(parent)); if (ReturnStmt *retS = dyn_cast_or_null<ReturnStmt>(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<ExprWithCleanups>(E)) - E = EWC->getSubExpr(); + if (const FullExpr *FE = dyn_cast<FullExpr>(E)) + E = FE->getSubExpr(); if (const ObjCMessageExpr * ME = dyn_cast<ObjCMessageExpr>(E->IgnoreParenCasts())) |