<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>std::list does support ripping out and inserting nodes in place (using the iterator versions of insert() and erase()), and using an ilist for a non-intrusive list seems weird.</div><div><br></div><div>I'm fairly sure flattening can still cause problems for when diagnostics are output twice, because PathDiagnosticPiece objects that contain path segments themselves really do need to be copied to make them independent. I don't think we really have a way to "share" the path pieces unless we have some kind of deepCloneNoLeaves() method.</div><div><br></div><br><div><div>On Apr 29, 2013, at 15:38 , Ted Kremenek <<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: kremenek<br>Date: Mon Apr 29 17:38:26 2013<br>New Revision: 180741<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=180741&view=rev">http://llvm.org/viewvc/llvm-project?rev=180741&view=rev</a><br>Log:<br>[analyzer] Change PathPieces to be a wrapper around an ilist of (through indirection) PathDiagnosticPieces.<br><br>Much of this patch outside of PathDiagnostics.h are just minor<br>syntactic changes due to the return type for operator* and the like<br>changing for the iterator, so the real focus should be on<br>PathPieces itself.<br><br>This change is motivated so that we can do efficient insertion<br>and removal of individual pieces from within a PathPiece, just like<br>this was a kind of "IR" for static analyzer diagnostics. We<br>currently implement path transformations by iterating over an<br>entire PathPiece and making a copy. This isn't very natural for<br>some algorithms.<br><br>We use an ilist here instead of std::list because we want operations<br>to rip out/insert nodes in place, just like IR manipulation. This<br>isn't being used yet, but opens the door for more powerful<br>transformation algorithms on diagnostic paths.<br><br>Modified:<br> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h<br> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br> cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br> cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp<br> cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br> cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp<br><br>Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)<br>+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Mon Apr 29 17:38:26 2013<br>@@ -20,6 +20,8 @@<br>#include "llvm/ADT/IntrusiveRefCntPtr.h"<br>#include "llvm/ADT/Optional.h"<br>#include "llvm/ADT/PointerUnion.h"<br>+#include "llvm/ADT/ilist.h"<br>+#include "llvm/ADT/ilist_node.h"<br>#include <deque><br>#include <iterator><br>#include <string><br>@@ -386,12 +388,32 @@ public:<br><br> virtual void Profile(llvm::FoldingSetNodeID &ID) const;<br>};<br>- <br>- <br>-class PathPieces : public std::deque<IntrusiveRefCntPtr<PathDiagnosticPiece> > {<br>+<br>+/// \brief An ordered collection of PathDiagnosticPieces.<br>+///<br>+/// Multiple PathPieces are allowed to reference the same PathDiagnosticPieces.<br>+/// This sharing is needed for some clients that want "flattened" copies<br>+/// of the same pieces.<br>+class PathPieces {<br>+ /// A simple wrapper for PathDiagnosticPiece, allowing sharing of<br>+ /// the same pieces between different PathPieces.<br>+ struct Node : public llvm::ilist_node<Node> {<br>+ IntrusiveRefCntPtr<PathDiagnosticPiece> Data;<br>+ explicit Node(PathDiagnosticPiece *P) : Data(P) {}<br>+ explicit Node() {}<br>+ };<br>+ llvm::ilist<Node> L;<br>+<br> void flattenTo(PathPieces &Primary, PathPieces &Current,<br> bool ShouldFlattenMacros) const;<br>+<br>public:<br>+ PathPieces() {}<br>+ PathPieces &operator=(const PathPieces & X);<br>+ PathPieces(const PathPieces &X) {<br>+ *this = X;<br>+ }<br>+<br> ~PathPieces();<br><br> PathPieces flatten(bool ShouldFlattenMacros) const {<br>@@ -399,6 +421,63 @@ public:<br> flattenTo(Result, Result, ShouldFlattenMacros);<br> return Result;<br> }<br>+<br>+ class iterator {<br>+ typedef llvm::ilist<Node>::iterator impl_iterator;<br>+ friend class PathPieces;<br>+ impl_iterator Impl;<br>+ iterator(const impl_iterator &Impl) : Impl(Impl) {}<br>+ public:<br>+ typedef PathDiagnosticPiece value_type;<br>+ typedef value_type* pointer;<br>+ typedef value_type& reference;<br>+ typedef ptrdiff_t difference_type;<br>+ typedef std::bidirectional_iterator_tag iterator_category;<br>+<br>+ bool operator==(const iterator &X) const {<br>+ return Impl == X.Impl;<br>+ }<br>+<br>+ bool operator!=(const iterator &X) const {<br>+ return Impl != X.Impl;<br>+ }<br>+<br>+ reference operator*() const { return *Impl->Data; }<br>+ pointer operator->() const { return Impl->Data.getPtr(); }<br>+<br>+ iterator &operator++() {<br>+ ++Impl;<br>+ return *this;<br>+ }<br>+<br>+ iterator &operator--() {<br>+ --Impl;<br>+ return *this;<br>+ }<br>+ };<br>+<br>+ typedef std::reverse_iterator<iterator> reverse_iterator;<br>+<br>+ iterator begin() const { return iterator(const_cast<PathPieces*>(this)->L.begin()); }<br>+ iterator end() const { return iterator(const_cast<PathPieces*>(this)->L.end()); }<br>+ reverse_iterator rbegin() { return reverse_iterator(end()); }<br>+ reverse_iterator rend() { return reverse_iterator(begin()); }<br>+<br>+ void push_front(PathDiagnosticPiece *P) {<br>+ L.push_front(new Node(P));<br>+ }<br>+ void pop_front() { L.pop_front(); }<br>+<br>+ void push_back(PathDiagnosticPiece *P) { L.push_back(new Node(P)); }<br>+ void push_back(const IntrusiveRefCntPtr<PathDiagnosticPiece> &P) {<br>+ push_back(P.getPtr());<br>+ }<br>+<br>+ PathDiagnosticPiece *front() const { return L.front().Data.getPtr(); }<br>+ PathDiagnosticPiece *back() const { return L.back().Data.getPtr(); }<br>+ void clear() { L.clear(); }<br>+ bool empty() const { return L.empty(); }<br>+ unsigned size() const { return L.size(); }<br>};<br><br>class PathDiagnosticSpotPiece : public PathDiagnosticPiece {<br>@@ -568,7 +647,7 @@ public:<br> callEnter.flatten();<br> callReturn.flatten();<br> for (PathPieces::iterator I = path.begin(),<span class="Apple-converted-space"> </span><br>- E = path.end(); I != E; ++I) (*I)->flattenLocations();<br>+ E = path.end(); I != E; ++I) I->flattenLocations();<br> }<br><br> static PathDiagnosticCallPiece *construct(const ExplodedNode *N,<br>@@ -655,7 +734,7 @@ public:<br> virtual void flattenLocations() {<br> PathDiagnosticSpotPiece::flattenLocations();<br> for (PathPieces::iterator I = subPieces.begin(),<span class="Apple-converted-space"> </span><br>- E = subPieces.end(); I != E; ++I) (*I)->flattenLocations();<br>+ E = subPieces.end(); I != E; ++I) I->flattenLocations();<br> }<br><br> static inline bool classof(const PathDiagnosticPiece *P) {<br>@@ -693,7 +772,7 @@ public:<br><br> ~PathDiagnostic();<br><br>- const PathPieces &path;<br>+ PathPieces &path;<br><br> /// Return the path currently used by builders for constructing the<span class="Apple-converted-space"> </span><br> /// PathDiagnostic.<br>@@ -764,7 +843,7 @@ public:<br> void flattenLocations() {<br> Loc.flatten();<br> for (PathPieces::iterator I = pathImpl.begin(), E = pathImpl.end();<span class="Apple-converted-space"> </span><br>- I != E; ++I) (*I)->flattenLocations();<br>+ I != E; ++I) I->flattenLocations();<br> }<br><br> /// Profiles the diagnostic, independent of the path it references.<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Mon Apr 29 17:38:26 2013<br>@@ -123,7 +123,7 @@ static void removeRedundantMsgs(PathPiec<br> break;<br><br> if (PathDiagnosticEventPiece *nextEvent =<br>- dyn_cast<PathDiagnosticEventPiece>(path.front().getPtr())) {<br>+ dyn_cast<PathDiagnosticEventPiece>(path.front())) {<br> PathDiagnosticEventPiece *event =<br> cast<PathDiagnosticEventPiece>(piece);<br> // Check to see if we should keep one of the two pieces. If we<br>@@ -210,10 +210,10 @@ bool BugReporter::RemoveUnneededCalls(Pa<br>static void adjustCallLocations(PathPieces &Pieces,<br> PathDiagnosticLocation *LastCallLocation = 0) {<br> for (PathPieces::iterator I = Pieces.begin(), E = Pieces.end(); I != E; ++I) {<br>- PathDiagnosticCallPiece *Call = dyn_cast<PathDiagnosticCallPiece>(*I);<br>+ PathDiagnosticCallPiece *Call = dyn_cast<PathDiagnosticCallPiece>(&*I);<br><br> if (!Call) {<br>- assert((*I)->getLocation().asLocation().isValid());<br>+ assert(I->getLocation().asLocation().isValid());<br> continue;<br> }<br><br>@@ -946,7 +946,7 @@ public:<br> // If the PathDiagnostic already has pieces, add the enclosing statement<br> // of the first piece as a context as well.<br> if (!PD.path.empty()) {<br>- PrevLoc = (*PD.path.begin())->getLocation();<br>+ PrevLoc = PD.path.begin()->getLocation();<br><br> if (const Stmt *S = PrevLoc.asStmt())<br> addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());<br>@@ -1987,10 +1987,10 @@ static void CompactPathDiagnostic(PathPi<br> MacroStackTy MacroStack;<br> PiecesTy Pieces;<br><br>- for (PathPieces::const_iterator I = path.begin(), E = path.end();<br>+ for (PathPieces::iterator I = path.begin(), E = path.end();<br> I!=E; ++I) {<br><br>- PathDiagnosticPiece *piece = I->getPtr();<br>+ PathDiagnosticPiece *piece = &*I;<br><br> // Recursively compact calls.<br> if (PathDiagnosticCallPiece *call=dyn_cast<PathDiagnosticCallPiece>(piece)){<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Mon Apr 29 17:38:26 2013<br>@@ -126,10 +126,10 @@ void HTMLDiagnostics::ReportDiag(const P<br><br> // The path as already been prechecked that all parts of the path are<br> // from the same file and that it is non-empty.<br>- const SourceManager &SMgr = (*path.begin())->getLocation().getManager();<br>+ const SourceManager &SMgr = path.begin()->getLocation().getManager();<br> assert(!path.empty());<br> FileID FID =<br>- (*path.begin())->getLocation().asLocation().getExpansionLoc().getFileID();<br>+ path.begin()->getLocation().asLocation().getExpansionLoc().getFileID();<br> assert(!FID.isInvalid());<br><br> // Create a new rewriter to generate HTML.<br>@@ -139,10 +139,10 @@ void HTMLDiagnostics::ReportDiag(const P<br> unsigned n = path.size();<br> unsigned max = n;<br><br>- for (PathPieces::const_reverse_iterator I = path.rbegin(),<span class="Apple-converted-space"> </span><br>+ for (PathPieces::reverse_iterator I = path.rbegin(),<span class="Apple-converted-space"> </span><br> E = path.rend();<br> I != E; ++I, --n)<br>- HandlePiece(R, FID, **I, n, max);<br>+ HandlePiece(R, FID, *I, n, max);<br><br> // Add line numbers, header, footer, etc.<br><br>@@ -185,9 +185,9 @@ void HTMLDiagnostics::ReportDiag(const P<br> << html::EscapeText(Entry->getName())<br> << "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>"<br> "<a href=\"#EndPath\">line "<br>- << (*path.rbegin())->getLocation().asLocation().getExpansionLineNumber()<br>+ << path.rbegin()->getLocation().asLocation().getExpansionLineNumber()<br> << ", column "<br>- << (*path.rbegin())->getLocation().asLocation().getExpansionColumnNumber()<br>+ << path.rbegin()->getLocation().asLocation().getExpansionColumnNumber()<br> << "</a></td></tr>\n"<br> "<tr><td class=\"rowname\">Description:</td><td>"<br> << D.getVerboseDescription() << "</td></tr>\n";<br>@@ -503,16 +503,16 @@ unsigned HTMLDiagnostics::ProcessMacroPi<br> const PathDiagnosticMacroPiece& P,<br> unsigned num) {<br><br>- for (PathPieces::const_iterator I = P.subPieces.begin(), E=P.subPieces.end();<br>+ for (PathPieces::iterator I = P.subPieces.begin(), E=P.subPieces.end();<br> I!=E; ++I) {<br><br> if (const PathDiagnosticMacroPiece *MP =<br>- dyn_cast<PathDiagnosticMacroPiece>(*I)) {<br>+ dyn_cast<PathDiagnosticMacroPiece>(&*I)) {<br> num = ProcessMacroPiece(os, *MP, num);<br> continue;<br> }<br><br>- if (PathDiagnosticEventPiece *EP = dyn_cast<PathDiagnosticEventPiece>(*I)) {<br>+ if (PathDiagnosticEventPiece *EP = dyn_cast<PathDiagnosticEventPiece>(&*I)){<br> os << "<div class=\"msg msgEvent\" style=\"width:94%; "<br> "margin-left:5px\">"<br> "<table class=\"msgT\"><tr>"<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Mon Apr 29 17:38:26 2013<br>@@ -28,11 +28,11 @@ using namespace clang;<br>using namespace ento;<br><br>bool PathDiagnosticMacroPiece::containsEvent() const {<br>- for (PathPieces::const_iterator I = subPieces.begin(), E = subPieces.end();<br>+ for (PathPieces::iterator I = subPieces.begin(), E = subPieces.end();<br> I!=E; ++I) {<br> if (isa<PathDiagnosticEventPiece>(*I))<br> return true;<br>- if (PathDiagnosticMacroPiece *MP = dyn_cast<PathDiagnosticMacroPiece>(*I))<br>+ if (PathDiagnosticMacroPiece *MP = dyn_cast<PathDiagnosticMacroPiece>(&*I))<br> if (MP->containsEvent())<br> return true;<br> }<br>@@ -59,13 +59,21 @@ PathDiagnosticCallPiece::~PathDiagnostic<br>PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {}<br>PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() {}<br><br>+PathPieces &PathPieces::operator=(const PathPieces & X) {<br>+ clear();<br>+ for (llvm::ilist<Node>::const_iterator I = X.L.begin(), E = X.L.end();<br>+ I != E; ++I) {<br>+ L.push_back(new Node(&*(I->Data)));<br>+ }<br>+ return *this;<br>+}<br><br>PathPieces::~PathPieces() {}<br><br>void PathPieces::flattenTo(PathPieces &Primary, PathPieces &Current,<br> bool ShouldFlattenMacros) const {<br>- for (PathPieces::const_iterator I = begin(), E = end(); I != E; ++I) {<br>- PathDiagnosticPiece *Piece = I->getPtr();<br>+ for (PathPieces::iterator I = begin(), E = end(); I != E; ++I) {<br>+ PathDiagnosticPiece *Piece = &*I;<br><br> switch (Piece->getKind()) {<br> case PathDiagnosticPiece::Call: {<br>@@ -145,7 +153,7 @@ void PathDiagnosticConsumer::HandlePathD<br> if (!supportsCrossFileDiagnostics()) {<br> // Verify that the entire path is from the same FileID.<br> FileID FID;<br>- const SourceManager &SMgr = (*D->path.begin())->getLocation().getManager();<br>+ const SourceManager &SMgr = D->path.begin()->getLocation().getManager();<br> SmallVector<const PathPieces *, 5> WorkList;<br> WorkList.push_back(&D->path);<br><br>@@ -153,9 +161,9 @@ void PathDiagnosticConsumer::HandlePathD<br> const PathPieces &path = *WorkList.back();<br> WorkList.pop_back();<br><br>- for (PathPieces::const_iterator I = path.begin(), E = path.end();<br>+ for (PathPieces::iterator I = path.begin(), E = path.end();<br> I != E; ++I) {<br>- const PathDiagnosticPiece *piece = I->getPtr();<br>+ const PathDiagnosticPiece *piece = &*I;<br> FullSourceLoc L = piece->getLocation().asLocation().getExpansionLoc();<br><br> if (FID.isInvalid()) {<br>@@ -298,11 +306,11 @@ static Optional<bool> comparePath(const<br> if (X.size() != Y.size())<br> return X.size() < Y.size();<br><br>- PathPieces::const_iterator X_I = X.begin(), X_end = X.end();<br>- PathPieces::const_iterator Y_I = Y.begin(), Y_end = Y.end();<br>+ PathPieces::iterator X_I = X.begin(), X_end = X.end();<br>+ PathPieces::iterator Y_I = Y.begin(), Y_end = Y.end();<br><br> for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {<br>- Optional<bool> b = comparePiece(**X_I, **Y_I);<br>+ Optional<bool> b = comparePiece(*X_I, *Y_I);<br> if (b.hasValue())<br> return b.getValue();<br> }<br>@@ -954,9 +962,9 @@ PathDiagnosticCallPiece::getCallExitEven<br>}<br><br>static void compute_path_size(const PathPieces &pieces, unsigned &size) {<br>- for (PathPieces::const_iterator it = pieces.begin(),<br>+ for (PathPieces::iterator it = pieces.begin(),<br> et = pieces.end(); it != et; ++it) {<br>- const PathDiagnosticPiece *piece = it->getPtr();<br>+ const PathDiagnosticPiece *piece = &*it;<br> if (const PathDiagnosticCallPiece *cp =<span class="Apple-converted-space"> </span><br> dyn_cast<PathDiagnosticCallPiece>(piece)) {<br> compute_path_size(cp->path, size);<br>@@ -998,9 +1006,9 @@ void PathDiagnosticPiece::Profile(llvm::<br><br>void PathDiagnosticCallPiece::Profile(llvm::FoldingSetNodeID &ID) const {<br> PathDiagnosticPiece::Profile(ID);<br>- for (PathPieces::const_iterator it = path.begin(),<span class="Apple-converted-space"> </span><br>+ for (PathPieces::iterator it = path.begin(),<span class="Apple-converted-space"> </span><br> et = path.end(); it != et; ++it) {<br>- ID.Add(**it);<br>+ ID.Add(*it);<br> }<br>}<br><br>@@ -1017,9 +1025,9 @@ void PathDiagnosticControlFlowPiece::Pro<br><br>void PathDiagnosticMacroPiece::Profile(llvm::FoldingSetNodeID &ID) const {<br> PathDiagnosticSpotPiece::Profile(ID);<br>- for (PathPieces::const_iterator I = subPieces.begin(), E = subPieces.end();<br>+ for (PathPieces::iterator I = subPieces.begin(), E = subPieces.end();<br> I != E; ++I)<br>- ID.Add(**I);<br>+ ID.Add(*I);<br>}<br><br>void PathDiagnostic::Profile(llvm::FoldingSetNodeID &ID) const {<br>@@ -1031,8 +1039,8 @@ void PathDiagnostic::Profile(llvm::Foldi<br><br>void PathDiagnostic::FullProfile(llvm::FoldingSetNodeID &ID) const {<br> Profile(ID);<br>- for (PathPieces::const_iterator I = path.begin(), E = path.end(); I != E; ++I)<br>- ID.Add(**I);<br>+ for (PathPieces::iterator I = path.begin(), E = path.end(); I != E; ++I)<br>+ ID.Add(*I);<br> for (meta_iterator I = meta_begin(), E = meta_end(); I != E; ++I)<br> ID.AddString(*I);<br>}<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Mon Apr 29 17:38:26 2013<br>@@ -294,8 +294,8 @@ static void ReportCall(raw_ostream &o,<br> ReportPiece(o, *callEnterWithinCaller, FM, SM, LangOpts,<br> indent, depth, true);<br><br>- for (PathPieces::const_iterator I = P.path.begin(), E = P.path.end();I!=E;++I)<br>- ReportPiece(o, **I, FM, SM, LangOpts, indent, depth, true);<br>+ for (PathPieces::iterator I = P.path.begin(), E = P.path.end();I!=E;++I)<br>+ ReportPiece(o, *I, FM, SM, LangOpts, indent, depth, true);<br><br> --depth;<br><br>@@ -313,9 +313,9 @@ static void ReportMacro(raw_ostream &o,<br> unsigned indent,<br> unsigned depth) {<br><br>- for (PathPieces::const_iterator I = P.subPieces.begin(), E=P.subPieces.end();<br>+ for (PathPieces::iterator I = P.subPieces.begin(), E=P.subPieces.end();<br> I!=E; ++I) {<br>- ReportPiece(o, **I, FM, SM, LangOpts, indent, depth, false);<br>+ ReportPiece(o, *I, FM, SM, LangOpts, indent, depth, false);<br> }<br>}<br><br>@@ -363,7 +363,7 @@ void PlistDiagnostics::FlushDiagnosticsI<br> const SourceManager* SM = 0;<br><br> if (!Diags.empty())<br>- SM = &(*(*Diags.begin())->path.begin())->getLocation().getManager();<br>+ SM = &(*(*Diags.begin())->path.begin()).getLocation().getManager();<br><br><br> for (std::vector<const PathDiagnostic*>::iterator DI = Diags.begin(),<br>@@ -378,9 +378,9 @@ void PlistDiagnostics::FlushDiagnosticsI<br> const PathPieces &path = *WorkList.back();<br> WorkList.pop_back();<br><br>- for (PathPieces::const_iterator I = path.begin(), E = path.end();<br>+ for (PathPieces::iterator I = path.begin(), E = path.end();<br> I!=E; ++I) {<br>- const PathDiagnosticPiece *piece = I->getPtr();<br>+ const PathDiagnosticPiece *piece = &*I;<br> AddFID(FM, Fids, SM, piece->getLocation().asLocation());<br> ArrayRef<SourceRange> Ranges = piece->getRanges();<br> for (ArrayRef<SourceRange>::iterator I = Ranges.begin(),<br>@@ -450,9 +450,9 @@ void PlistDiagnostics::FlushDiagnosticsI<br><br> o << " <array>\n";<br><br>- for (PathPieces::const_iterator I = D->path.begin(), E = D->path.end();<span class="Apple-converted-space"> </span><br>+ for (PathPieces::iterator I = D->path.begin(), E = D->path.end();<span class="Apple-converted-space"> </span><br> I != E; ++I)<br>- ReportDiag(o, **I, FM, *SM, LangOpts);<br>+ ReportDiag(o, *I, FM, *SM, LangOpts);<br><br> o << " </array>\n";<br><br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp?rev=180741&r1=180740&r2=180741&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp Mon Apr 29 17:38:26 2013<br>@@ -61,12 +61,12 @@ void TextPathDiagnostics::FlushDiagnosti<br> const PathDiagnostic *D = *it;<br><br> PathPieces FlatPath = D->path.flatten(/*ShouldFlattenMacros=*/true);<br>- for (PathPieces::const_iterator I = FlatPath.begin(), E = FlatPath.end();<span class="Apple-converted-space"> </span><br>+ for (PathPieces::iterator I = FlatPath.begin(), E = FlatPath.end();<span class="Apple-converted-space"> </span><br> I != E; ++I) {<br> unsigned diagID =<br> Diag.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Note,<br>- (*I)->getString());<br>- Diag.Report((*I)->getLocation().asLocation(), diagID);<br>+ I->getString());<br>+ Diag.Report(I->getLocation().asLocation(), diagID);<br> }<br> }<br>}<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div><br></body></html>