]> granicus.if.org Git - clang/commitdiff
[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.
authorTed Kremenek <kremenek@apple.com>
Tue, 7 May 2013 21:11:57 +0000 (21:11 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 7 May 2013 21:11:57 +0000 (21:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181359 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/BugReporter.cpp

index a74acca06050e799ccf9ec75c72d8dc64e0ce23a..f4aa9ef6f48e0f17b58dc50ac702e5490f85491a 100644 (file)
@@ -1815,8 +1815,13 @@ const Stmt *getStmtParent(const Stmt *S, ParentMap &PM) {
 }
 
 static bool isConditionForTerminator(const Stmt *S, const Stmt *Cond) {
-  // Note that we intentionally to do not handle || and && here.
   switch (S->getStmtClass()) {
+    case Stmt::BinaryOperatorClass: {
+      const BinaryOperator *BO = cast<BinaryOperator>(S);
+      if (!BO->isLogicalOp())
+        return false;
+      return BO->getLHS() == Cond || BO->getRHS() == Cond;
+    }
     case Stmt::IfStmtClass:
       return cast<IfStmt>(S)->getCond() == Cond;
     case Stmt::ForStmtClass: