diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-05-09 06:55:41 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-05-09 06:55:41 +0000 |
| commit | afde200cdae9731aa5826c6178eae9e7fef74475 (patch) | |
| tree | ee60b6e0e68237157e00abcf4fcbb7fce4598734 /lib/StaticAnalyzer/Core/BugReporter.cpp | |
| parent | 8841c532f217d938f47f4feaa3707b929cd71181 (diff) | |
| download | clang-afde200cdae9731aa5826c6178eae9e7fef74475.tar.gz clang-afde200cdae9731aa5826c6178eae9e7fef74475.tar.bz2 clang-afde200cdae9731aa5826c6178eae9e7fef74475.tar.xz | |
[analyzer; alternate arrows] for "loop back" edges add back the extra edge to the closing '}'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181505 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
| -rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 7ce3f98867..b43625f806 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1722,6 +1722,12 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, // 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 " @@ -1730,6 +1736,12 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), PDB.LC); PD.getActivePath().push_front(p); + + if (CS) { + addEdgeToPath(PD.getActivePath(), PrevLoc, + PathDiagnosticLocation::createEndBrace(CS, SM), + PDB.LC); + } } const CFGBlock *BSrc = BE->getSrc(); |
