Added method Expr::IgnoreParens(), which returns the first non-ParenExpr Expr*.
Refactored the use of this method into both the Sema module and Analysis module,
which were using their own static functions that did the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46129 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 2eda869..64cc199 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -216,13 +216,6 @@
};
} // end anonymous namespace
-static inline Expr* IgnoreParen(Expr* E) {
- while (ParenExpr* P = dyn_cast<ParenExpr>(E))
- E = P->getSubExpr();
-
- return E;
-}
-
void GRConstants::ProcessStmt(Stmt* S, NodeBuilder& builder) {
Builder = &builder;
Nodes->clear();
@@ -237,7 +230,7 @@
ExprVariantTy GRConstants::GetBinding(Expr* E) {
DSPtr P(NULL);
- E = IgnoreParen(E);
+ E = E->IgnoreParens();
switch (E->getStmtClass()) {
case Stmt::DeclRefExprClass:
@@ -364,7 +357,7 @@
void GRConstants::VisitBinAssign(BinaryOperator* B) {
- if (DeclRefExpr* D = dyn_cast<DeclRefExpr>(IgnoreParen(B->getLHS())))
+ if (DeclRefExpr* D = dyn_cast<DeclRefExpr>(B->getLHS()->IgnoreParens()))
AddBinding(D->getDecl(), GetBinding(B->getRHS()));
}