diff options
author | Anna Zaks <ganna@apple.com> | 2012-06-02 00:40:52 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-06-02 00:40:52 +0000 |
commit | 7ba26150478748c050aa61753e6ced319fa72987 (patch) | |
tree | 9311ebd51efd16afa74ff9c41c316ff0ca382429 | |
parent | 561e190a36c9fd4aae01c412cc715e67a3171a74 (diff) | |
download | bcm5719-llvm-7ba26150478748c050aa61753e6ced319fa72987.tar.gz bcm5719-llvm-7ba26150478748c050aa61753e6ced319fa72987.zip |
[analyzer] Rely on canBeInlined utility instead of checking CallExpr
explicitly.
This will make it easier to add inlining support to more expressions.
llvm-svn: 157870
-rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h | 5 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp | 3 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h index 0b260e48796..f01bad02c20 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h @@ -281,6 +281,11 @@ public: // TODO: To reduce false negatives here, we should track the container // allocation site and check if a proper deallocator was set there. static bool isCFCGAllowingEscape(StringRef FName); + + // Check if this kind of expression can be inlined by the analyzer. + static bool canBeInlined(const Stmt *S) { + return isa<CallExpr>(S); + } }; } diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 5b9f451e971..b75765d336e 100644 --- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" #include "clang/AST/Stmt.h" #include "clang/AST/ParentMap.h" @@ -114,7 +115,7 @@ bool ExplodedGraph::shouldCollect(const ExplodedNode *node) { // Condition 9. const ProgramPoint SuccLoc = succ->getLocation(); if (const StmtPoint *SP = dyn_cast<StmtPoint>(&SuccLoc)) - if (isa<CallExpr>(SP->getStmt())) + if (CallOrObjCMessage::canBeInlined(SP->getStmt())) return false; return true; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 22e5bc828e5..6531265807c 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -250,7 +250,7 @@ static bool shouldRemoveDeadBindings(AnalysisManager &AMgr, return true; // Run before processing a call. - if (isa<CallExpr>(S.getStmt())) + if (CallOrObjCMessage::canBeInlined(S.getStmt())) return true; // Is this an expression that is consumed by another expression? If so, |