aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp50
1 files changed, 11 insertions, 39 deletions
diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 8004ef45a6..e39d32db96 100644
--- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -95,31 +95,8 @@ void HTMLDiagnostics::FlushDiagnosticsImpl(
}
}
-static void flattenPath(PathPieces &path, const PathPieces &oldPath) {
- for (PathPieces::const_iterator it = oldPath.begin(), et = oldPath.end();
- it != et; ++it ) {
- PathDiagnosticPiece *piece = it->getPtr();
- if (const PathDiagnosticCallPiece *call =
- dyn_cast<PathDiagnosticCallPiece>(piece)) {
- IntrusiveRefCntPtr<PathDiagnosticEventPiece> callEnter =
- call->getCallEnterEvent();
- if (callEnter)
- path.push_back(callEnter);
- flattenPath(path, call->path);
- IntrusiveRefCntPtr<PathDiagnosticEventPiece> callExit =
- call->getCallExitEvent();
- if (callExit)
- path.push_back(callExit);
- continue;
- }
-
- path.push_back(piece);
- }
-}
-
void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
- SmallVectorImpl<std::string> *FilesMade) {
-
+ SmallVectorImpl<std::string> *FilesMade){
// Create the HTML directory if it is missing.
if (!createdDir) {
createdDir = true;
@@ -142,15 +119,11 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
if (noDir)
return;
- // First flatten out the entire path to make it easier to use.
- PathPieces path;
- flattenPath(path, D.path);
-
- const SourceManager &SMgr = (*path.begin())->getLocation().getManager();
+ const SourceManager &SMgr = (*D.path.begin())->getLocation().getManager();
FileID FID;
// Verify that the entire path is from the same FileID.
- for (PathPieces::const_iterator I = path.begin(), E = path.end();
+ for (PathPieces::const_iterator I = D.path.begin(), E = D.path.end();
I != E; ++I) {
FullSourceLoc L = (*I)->getLocation().asLocation().getExpansionLoc();
@@ -179,11 +152,10 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
Rewriter R(const_cast<SourceManager&>(SMgr), PP.getLangOptions());
// Process the path.
- unsigned n = path.size();
+ unsigned n = D.path.size();
unsigned max = n;
- for (PathPieces::const_reverse_iterator I = path.rbegin(),
- E = path.rend();
+ for (PathPieces::const_reverse_iterator I = D.path.rbegin(), E=D.path.rend();
I != E; ++I, --n)
HandlePiece(R, FID, **I, n, max);
@@ -228,9 +200,9 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
<< html::EscapeText(Entry->getName())
<< "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>"
"<a href=\"#EndPath\">line "
- << (*path.rbegin())->getLocation().asLocation().getExpansionLineNumber()
+ << (*D.path.rbegin())->getLocation().asLocation().getExpansionLineNumber()
<< ", column "
- << (*path.rbegin())->getLocation().asLocation().getExpansionColumnNumber()
+ << (*D.path.rbegin())->getLocation().asLocation().getExpansionColumnNumber()
<< "</a></td></tr>\n"
"<tr><td class=\"rowname\">Description:</td><td>"
<< D.getDescription() << "</td></tr>\n";
@@ -268,10 +240,10 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
os << "\n<!-- BUGFILE " << DirName << Entry->getName() << " -->\n";
os << "\n<!-- BUGLINE "
- << path.back()->getLocation().asLocation().getExpansionLineNumber()
+ << D.path.back()->getLocation().asLocation().getExpansionLineNumber()
<< " -->\n";
- os << "\n<!-- BUGPATHLENGTH " << path.size() << " -->\n";
+ os << "\n<!-- BUGPATHLENGTH " << D.path.size() << " -->\n";
// Mark the end of the tags.
os << "\n<!-- BUGMETAEND -->\n";
@@ -360,8 +332,8 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
const char *Kind = 0;
switch (P.getKind()) {
- case PathDiagnosticPiece::Call:
- llvm_unreachable("Calls should already be handled");
+ case PathDiagnosticPiece::CallEnter:
+ case PathDiagnosticPiece::CallExit:
case PathDiagnosticPiece::Event: Kind = "Event"; break;
case PathDiagnosticPiece::ControlFlow: Kind = "Control"; break;
// Setting Kind to "Control" is intentional.