aboutsummaryrefslogtreecommitdiff
path: root/Analysis/GRConstants.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-17 16:57:34 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-17 16:57:34 +0000
commit4e99a5fc3b203397a91136c6e695e405fb8fc606 (patch)
tree2b733364d0b34dfb61041b5d7cbc4d7657963c60 /Analysis/GRConstants.cpp
parent847794a7620bfd5fda09ee06bc0205d30e17e2aa (diff)
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
Diffstat (limited to 'Analysis/GRConstants.cpp')
-rw-r--r--Analysis/GRConstants.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 2eda869c0e..64cc199b57 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -216,13 +216,6 @@ public:
};
} // 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 @@ void GRConstants::ProcessStmt(Stmt* S, NodeBuilder& builder) {
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::VisitBinSub(BinaryOperator* B) {
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()));
}