diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-03-02 01:27:31 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-03-02 01:27:31 +0000 |
commit | 77d09441e59d3bced6c3d55505eb3a67a784fe02 (patch) | |
tree | 97d0a753171af6ec71628f108f5c141f344bde2a /lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | |
parent | e853bb34ec1f86e12dcdaa9b5e782fac2117b08f (diff) |
[analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.
This also adds a test case for r151774.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 3740ba1005..09c2f794d6 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -95,7 +95,8 @@ void HTMLDiagnostics::FlushDiagnosticsImpl( } } -static void flattenPath(PathPieces &path, const PathPieces &oldPath) { +static void flattenPath(PathPieces &primaryPath, PathPieces ¤tPath, + const PathPieces &oldPath) { for (PathPieces::const_iterator it = oldPath.begin(), et = oldPath.end(); it != et; ++it ) { PathDiagnosticPiece *piece = it->getPtr(); @@ -104,16 +105,24 @@ static void flattenPath(PathPieces &path, const PathPieces &oldPath) { IntrusiveRefCntPtr<PathDiagnosticEventPiece> callEnter = call->getCallEnterEvent(); if (callEnter) - path.push_back(callEnter); - flattenPath(path, call->path); + currentPath.push_back(callEnter); + flattenPath(primaryPath, primaryPath, call->path); IntrusiveRefCntPtr<PathDiagnosticEventPiece> callExit = call->getCallExitEvent(); if (callExit) - path.push_back(callExit); + currentPath.push_back(callExit); continue; } - - path.push_back(piece); + if (PathDiagnosticMacroPiece *macro = + dyn_cast<PathDiagnosticMacroPiece>(piece)) { + currentPath.push_back(piece); + PathPieces newPath; + flattenPath(primaryPath, newPath, macro->subPieces); + macro->subPieces = newPath; + continue; + } + + currentPath.push_back(piece); } } @@ -144,7 +153,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, // First flatten out the entire path to make it easier to use. PathPieces path; - flattenPath(path, D.path); + flattenPath(path, path, D.path); // The path as already been prechecked that all parts of the path are // from the same file and that it is non-empty. |