]> granicus.if.org Git - clang/commitdiff
[analyzer] Rely on canBeInlined utility instead of checking CallExpr
authorAnna Zaks <ganna@apple.com>
Sat, 2 Jun 2012 00:40:52 +0000 (00:40 +0000)
committerAnna Zaks <ganna@apple.com>
Sat, 2 Jun 2012 00:40:52 +0000 (00:40 +0000)
explicitly.

This will make it easier to add inlining support to more expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157870 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
lib/StaticAnalyzer/Core/ExplodedGraph.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp

index 0b260e4879678edc9e558d4f2ca4e6e95f6f35bc..f01bad02c2033be0d735744e9feaecac0cb3cc63 100644 (file)
@@ -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);
+  }
 };
 
 }
index 5b9f451e971f75b2ee6dc70d4b64e878c0e5a96f..b75765d336e4cf262d80be7dabc61825b46a5b50 100644 (file)
@@ -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;
index 22e5bc828e57e0a86012d3ce7fd3d0f38194ca24..6531265807cbfb592ac5b4e156ba6090b3161c73 100644 (file)
@@ -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,