]> granicus.if.org Git - clang/commitdiff
[analyzer] Cleanup: only get the PostStmt when we need the underlying Stmt + comment
authorAnna Zaks <ganna@apple.com>
Wed, 27 Mar 2013 17:36:01 +0000 (17:36 +0000)
committerAnna Zaks <ganna@apple.com>
Wed, 27 Mar 2013 17:36:01 +0000 (17:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178153 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExplodedGraph.cpp

index ca466d89070c82ebafb481c62e3755c9fc18c54c..af9518acc79d0e060316bcb20a712a2bc83b65e7 100644 (file)
@@ -117,8 +117,7 @@ bool ExplodedGraph::shouldCollect(const ExplodedNode *node) {
     return false;
 
   // Condition 4.
-  PostStmt ps = progPoint.castAs<PostStmt>();
-  if (ps.getTag())
+  if (progPoint.getTag())
     return false;
 
   // Conditions 5, 6, and 7.
@@ -128,8 +127,9 @@ bool ExplodedGraph::shouldCollect(const ExplodedNode *node) {
       progPoint.getLocationContext() != pred->getLocationContext())
     return false;
 
-  // All further checks require expressions.
-  const Expr *Ex = dyn_cast<Expr>(ps.getStmt());
+  // All further checks require expressions. As per #3, we know that we have
+  // a PostStmt.
+  const Expr *Ex = dyn_cast<Expr>(progPoint.castAs<PostStmt>().getStmt());
   if (!Ex)
     return false;