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/PlistDiagnostics.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/PlistDiagnostics.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index 850955561e..2701951410 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -294,8 +294,8 @@ static void ReportCall(raw_ostream &o, ReportPiece(o, *callEnterWithinCaller, FM, SM, LangOpts, indent, depth, true); - for (PathPieces::const_iterator I = P.path.begin(), E = P.path.end();I!=E;++I) - ReportPiece(o, **I, FM, SM, LangOpts, indent, depth, true); + for (PathPieces::iterator I = P.path.begin(), E = P.path.end();I!=E;++I) + ReportPiece(o, *I, FM, SM, LangOpts, indent, depth, true); --depth; @@ -313,9 +313,9 @@ static void ReportMacro(raw_ostream &o, unsigned indent, unsigned depth) { - 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) { - ReportPiece(o, **I, FM, SM, LangOpts, indent, depth, false); + ReportPiece(o, *I, FM, SM, LangOpts, indent, depth, false); } } @@ -363,7 +363,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl( const SourceManager* SM = 0; if (!Diags.empty()) - SM = &(*(*Diags.begin())->path.begin())->getLocation().getManager(); + SM = &(*(*Diags.begin())->path.begin()).getLocation().getManager(); for (std::vector<const PathDiagnostic*>::iterator DI = Diags.begin(), @@ -378,9 +378,9 @@ void PlistDiagnostics::FlushDiagnosticsImpl( const PathPieces &path = *WorkList.back(); WorkList.pop_back(); - for (PathPieces::const_iterator I = path.begin(), E = path.end(); + for (PathPieces::iterator I = path.begin(), E = path.end(); I!=E; ++I) { - const PathDiagnosticPiece *piece = I->getPtr(); + const PathDiagnosticPiece *piece = &*I; AddFID(FM, Fids, SM, piece->getLocation().asLocation()); ArrayRef<SourceRange> Ranges = piece->getRanges(); for (ArrayRef<SourceRange>::iterator I = Ranges.begin(), @@ -450,9 +450,9 @@ void PlistDiagnostics::FlushDiagnosticsImpl( o << " <array>\n"; - for (PathPieces::const_iterator I = D->path.begin(), E = D->path.end(); + for (PathPieces::iterator I = D->path.begin(), E = D->path.end(); I != E; ++I) - ReportDiag(o, **I, FM, *SM, LangOpts); + ReportDiag(o, *I, FM, *SM, LangOpts); o << " </array>\n"; |