From 7651e53997e20f1e627ffce25ce613f79c48e3e3 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 29 Apr 2013 22:38:26 +0000 Subject: [analyzer] Change PathPieces to be a wrapper around an ilist of (through indirection) PathDiagnosticPieces. Much of this patch outside of PathDiagnostics.h are just minor syntactic changes due to the return type for operator* and the like changing for the iterator, so the real focus should be on PathPieces itself. This change is motivated so that we can do efficient insertion and removal of individual pieces from within a PathPiece, just like this was a kind of "IR" for static analyzer diagnostics. We currently implement path transformations by iterating over an entire PathPiece and making a copy. This isn't very natural for some algorithms. We use an ilist here instead of std::list because we want operations to rip out/insert nodes in place, just like IR manipulation. This isn't being used yet, but opens the door for more powerful transformation algorithms on diagnostic paths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180741 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp') diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 73426da2b4..a5fe300fb6 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -126,10 +126,10 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, // The path as already been prechecked that all parts of the path are // from the same file and that it is non-empty. - const SourceManager &SMgr = (*path.begin())->getLocation().getManager(); + const SourceManager &SMgr = path.begin()->getLocation().getManager(); assert(!path.empty()); FileID FID = - (*path.begin())->getLocation().asLocation().getExpansionLoc().getFileID(); + path.begin()->getLocation().asLocation().getExpansionLoc().getFileID(); assert(!FID.isInvalid()); // Create a new rewriter to generate HTML. @@ -139,10 +139,10 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, unsigned n = path.size(); unsigned max = n; - for (PathPieces::const_reverse_iterator I = path.rbegin(), + for (PathPieces::reverse_iterator I = path.rbegin(), E = path.rend(); I != E; ++I, --n) - HandlePiece(R, FID, **I, n, max); + HandlePiece(R, FID, *I, n, max); // Add line numbers, header, footer, etc. @@ -185,9 +185,9 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, << html::EscapeText(Entry->getName()) << "\nLocation:" "line " - << (*path.rbegin())->getLocation().asLocation().getExpansionLineNumber() + << path.rbegin()->getLocation().asLocation().getExpansionLineNumber() << ", column " - << (*path.rbegin())->getLocation().asLocation().getExpansionColumnNumber() + << path.rbegin()->getLocation().asLocation().getExpansionColumnNumber() << "\n" "Description:" << D.getVerboseDescription() << "\n"; @@ -503,16 +503,16 @@ unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream &os, const PathDiagnosticMacroPiece& P, unsigned num) { - for (PathPieces::const_iterator I = P.subPieces.begin(), E=P.subPieces.end(); + for (PathPieces::iterator I = P.subPieces.begin(), E=P.subPieces.end(); I!=E; ++I) { if (const PathDiagnosticMacroPiece *MP = - dyn_cast(*I)) { + dyn_cast(&*I)) { num = ProcessMacroPiece(os, *MP, num); continue; } - if (PathDiagnosticEventPiece *EP = dyn_cast(*I)) { + if (PathDiagnosticEventPiece *EP = dyn_cast(&*I)){ os << "
" "" -- cgit v1.2.3-18-g5258