r181359 - [analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.

Ted Kremenek kremenek at apple.com
Tue May 7 14:11:57 PDT 2013


Author: kremenek
Date: Tue May  7 16:11:57 2013
New Revision: 181359

URL: http://llvm.org/viewvc/llvm-project?rev=181359&view=rev
Log:
[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=181359&r1=181358&r2=181359&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Tue May  7 16:11:57 2013
@@ -1815,8 +1815,13 @@ const Stmt *getStmtParent(const Stmt *S,
 }
 
 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:





More information about the cfe-commits mailing list