diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-04-29 22:38:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-04-29 22:38:26 +0000 |
commit | 7651e53997e20f1e627ffce25ce613f79c48e3e3 (patch) | |
tree | ea1a13ee44d721dc32902f20dacae559eb6aa4e2 /lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | b5142359abc50e151c18bde88fbabec98b65077c (diff) |
[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
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 52c364e891..930f4bc99a 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -123,7 +123,7 @@ static void removeRedundantMsgs(PathPieces &path) { break; if (PathDiagnosticEventPiece *nextEvent = - dyn_cast<PathDiagnosticEventPiece>(path.front().getPtr())) { + dyn_cast<PathDiagnosticEventPiece>(path.front())) { PathDiagnosticEventPiece *event = cast<PathDiagnosticEventPiece>(piece); // Check to see if we should keep one of the two pieces. If we @@ -210,10 +210,10 @@ bool BugReporter::RemoveUnneededCalls(PathPieces &pieces, BugReport *R) { static void adjustCallLocations(PathPieces &Pieces, PathDiagnosticLocation *LastCallLocation = 0) { for (PathPieces::iterator I = Pieces.begin(), E = Pieces.end(); I != E; ++I) { - PathDiagnosticCallPiece *Call = dyn_cast<PathDiagnosticCallPiece>(*I); + PathDiagnosticCallPiece *Call = dyn_cast<PathDiagnosticCallPiece>(&*I); if (!Call) { - assert((*I)->getLocation().asLocation().isValid()); + assert(I->getLocation().asLocation().isValid()); continue; } @@ -946,7 +946,7 @@ public: // If the PathDiagnostic already has pieces, add the enclosing statement // of the first piece as a context as well. if (!PD.path.empty()) { - PrevLoc = (*PD.path.begin())->getLocation(); + PrevLoc = PD.path.begin()->getLocation(); if (const Stmt *S = PrevLoc.asStmt()) addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt()); @@ -1987,10 +1987,10 @@ static void CompactPathDiagnostic(PathPieces &path, const SourceManager& SM) { MacroStackTy MacroStack; PiecesTy Pieces; - for (PathPieces::const_iterator I = path.begin(), E = path.end(); + for (PathPieces::iterator I = path.begin(), E = path.end(); I!=E; ++I) { - PathDiagnosticPiece *piece = I->getPtr(); + PathDiagnosticPiece *piece = &*I; // Recursively compact calls. if (PathDiagnosticCallPiece *call=dyn_cast<PathDiagnosticCallPiece>(piece)){ |