r181357 - [analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no value.

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


Author: kremenek
Date: Tue May  7 16:11:52 2013
New Revision: 181357

URL: http://llvm.org/viewvc/llvm-project?rev=181357&view=rev
Log:
[analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no value.

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=181357&r1=181356&r2=181357&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Tue May  7 16:11:52 2013
@@ -1723,12 +1723,6 @@ GenerateAlternateExtensivePathDiagnostic
         // Are we jumping to the head of a loop?  Add a special diagnostic.
         if (const Stmt *Loop = BE->getSrc()->getLoopTarget()) {
           PathDiagnosticLocation L(Loop, SM, PDB.LC);
-          const CompoundStmt *CS = NULL;
-
-          if (const ForStmt *FS = dyn_cast<ForStmt>(Loop))
-            CS = dyn_cast<CompoundStmt>(FS->getBody());
-          else if (const WhileStmt *WS = dyn_cast<WhileStmt>(Loop))
-            CS = dyn_cast<CompoundStmt>(WS->getBody());
 
           PathDiagnosticEventPiece *p =
             new PathDiagnosticEventPiece(L, "Looping back to the head "
@@ -1738,11 +1732,6 @@ GenerateAlternateExtensivePathDiagnostic
           addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC);
           PD.getActivePath().push_front(p);
           EventCategory[p] = EC_LoopingBack;
-
-          if (CS) {
-            addEdgeToPath(PD.getActivePath(), PrevLoc,
-                          PathDiagnosticLocation::createEndBrace(CS, SM), LC);
-          }
         }
 
         const CFGBlock *BSrc = BE->getSrc();





More information about the cfe-commits mailing list