<div dir="ltr"><div>Can't reproduce on my Windows.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 3, 2016 at 1:31 PM Artem Dergachev <<a href="mailto:noqnoqneo@gmail.com">noqnoqneo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<p class="gmail_msg">I also made a quick blind guess at r283141
(<a class="m_-2630513323378653476moz-txt-link-freetext gmail_msg" href="http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161003/172390.html" target="_blank">http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161003/172390.html</a>)</p>
<p class="gmail_msg">Thanks a lot for trying to help, sorry for causing problems.<br class="gmail_msg">
</p>
<br class="gmail_msg">
<div class="m_-2630513323378653476moz-cite-prefix gmail_msg">03/10/2016 23:26, Vitaly Buka пишет:<br class="gmail_msg">
</div></div><div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div dir="ltr" class="gmail_msg">I will look into this and get back to you. </div>
<br class="gmail_msg">
<div class="gmail_quote gmail_msg">
<div dir="ltr" class="gmail_msg">On Mon, Oct 3, 2016 at 12:12 PM Artem Dergachev
<<a href="mailto:noqnoqneo@gmail.com" class="gmail_msg" target="_blank">noqnoqneo@gmail.com</a>>
wrote:<br class="gmail_msg">
</div>
<blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg"> >
fatal error C1001: An internal error has occurred in the
compiler.<br class="gmail_msg">
<br class="gmail_msg">
Ouch. So i managed to *crash* the microsoft compiler with my
code?<br class="gmail_msg">
<br class="gmail_msg">
Could you please somehow have a look if this is
reproducible? If it's reproducible or
hard-to-check-if-reproducible then i'd revert.<br class="gmail_msg">
<br class="gmail_msg">
I don't think i can debug this, as i don't have windows, and
i have no guesses from looking at the code.<br class="gmail_msg">
<br class="gmail_msg">
Also, should i have received an email for this failure?
Cause i haven't received an email for this failure. Hope
there aren't more failures.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<div class="m_-2630513323378653476m_-1065106170221421501moz-cite-prefix gmail_msg">03/10/2016
21:46, Vitaly Buka via cfe-commits пишет:<br class="gmail_msg">
</div>
</div>
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div dir="ltr" class="gmail_msg">This patch breaks
Windows: <a href="http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/" class="gmail_msg" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/</a></div>
<br class="gmail_msg">
<div class="gmail_quote gmail_msg">
<div dir="ltr" class="gmail_msg">On Mon, Oct 3, 2016 at
1:07 AM Artem Dergachev via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a>>
wrote:<br class="gmail_msg">
</div>
<blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dergachev<br class="gmail_msg">
Date: Mon Oct 3 02:58:26 2016<br class="gmail_msg">
New Revision: 283092<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=283092&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=283092&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[analyzer] Extend bug reports with extra notes<br class="gmail_msg">
<br class="gmail_msg">
These diagnostics are separate from the path-sensitive
engine's path notes,<br class="gmail_msg">
and can be added manually on top of path-sensitive or
path-insensitive reports.<br class="gmail_msg">
<br class="gmail_msg">
The new note diagnostics would appear as
note:-diagnostic on console and<br class="gmail_msg">
as blue bubbles in scan-build. In plist files they
currently do not appear,<br class="gmail_msg">
because format needs to be discussed with plist file
users.<br class="gmail_msg">
<br class="gmail_msg">
The analyzer option "-analyzer-config
notes-as-events=true" would convert<br class="gmail_msg">
notes to normal path notes, and put them at the
beginning of the path.<br class="gmail_msg">
This is a temporary hack to show the new notes in
plist files.<br class="gmail_msg">
<br class="gmail_msg">
A few checkers would be updated in subsequent commits,<br class="gmail_msg">
including tests for this new feature.<br class="gmail_msg">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D24278" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D24278</a><br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br class="gmail_msg">
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h<br class="gmail_msg">
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h<br class="gmail_msg">
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br class="gmail_msg">
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
(original)<br class="gmail_msg">
+++
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -266,6 +266,9 @@ private:<br class="gmail_msg">
/// \sa shouldWidenLoops<br class="gmail_msg">
Optional<bool> WidenLoops;<br class="gmail_msg">
<br class="gmail_msg">
+ /// \sa shouldDisplayNotesAsEvents<br class="gmail_msg">
+ Optional<bool> DisplayNotesAsEvents;<br class="gmail_msg">
+<br class="gmail_msg">
/// A helper function that retrieves option for a
given full-qualified<br class="gmail_msg">
/// checker name.<br class="gmail_msg">
/// Options for checkers can be specified via
'analyzer-config' command-line<br class="gmail_msg">
@@ -534,6 +537,14 @@ public:<br class="gmail_msg">
/// This is controlled by the 'widen-loops' config
option.<br class="gmail_msg">
bool shouldWidenLoops();<br class="gmail_msg">
<br class="gmail_msg">
+ /// Returns true if the bug reporter should
transparently treat extra note<br class="gmail_msg">
+ /// diagnostic pieces as event diagnostic pieces.
Useful when the diagnostic<br class="gmail_msg">
+ /// consumer doesn't support the extra note pieces.<br class="gmail_msg">
+ ///<br class="gmail_msg">
+ /// This is controlled by the 'notes-as-events'
option, which defaults<br class="gmail_msg">
+ /// to false when unset.<br class="gmail_msg">
+ bool shouldDisplayNotesAsEvents();<br class="gmail_msg">
+<br class="gmail_msg">
public:<br class="gmail_msg">
AnalyzerOptions() :<br class="gmail_msg">
AnalysisStoreOpt(RegionStoreModel),<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
(original)<br class="gmail_msg">
+++
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -66,6 +66,8 @@ public:<br class="gmail_msg">
typedef
SmallVector<std::unique_ptr<BugReporterVisitor>,
8> VisitorList;<br class="gmail_msg">
typedef VisitorList::iterator visitor_iterator;<br class="gmail_msg">
typedef SmallVector<StringRef, 2>
ExtraTextList;<br class="gmail_msg">
+ typedef
SmallVector<llvm::IntrusiveRefCntPtr<PathDiagnosticNotePiece>,
4><br class="gmail_msg">
+ NoteList;<br class="gmail_msg">
<br class="gmail_msg">
protected:<br class="gmail_msg">
friend class BugReporter;<br class="gmail_msg">
@@ -82,7 +84,8 @@ protected:<br class="gmail_msg">
const ExplodedNode *ErrorNode;<br class="gmail_msg">
SmallVector<SourceRange, 4> Ranges;<br class="gmail_msg">
ExtraTextList ExtraText;<br class="gmail_msg">
-<br class="gmail_msg">
+ NoteList Notes;<br class="gmail_msg">
+<br class="gmail_msg">
typedef llvm::DenseSet<SymbolRef> Symbols;<br class="gmail_msg">
typedef llvm::DenseSet<const MemRegion *>
Regions;<br class="gmail_msg">
<br class="gmail_msg">
@@ -177,6 +180,18 @@ public:<br class="gmail_msg">
const BugType& getBugType() const { return BT;
}<br class="gmail_msg">
BugType& getBugType() { return BT; }<br class="gmail_msg">
<br class="gmail_msg">
+ /// \brief True when the report has an execution
path associated with it.<br class="gmail_msg">
+ ///<br class="gmail_msg">
+ /// A report is said to be path-sensitive if it was
thrown against a<br class="gmail_msg">
+ /// particular exploded node in the path-sensitive
analysis graph.<br class="gmail_msg">
+ /// Path-sensitive reports have their intermediate
path diagnostics<br class="gmail_msg">
+ /// auto-generated, perhaps with the help of
checker-defined visitors,<br class="gmail_msg">
+ /// and may contain extra notes.<br class="gmail_msg">
+ /// Path-insensitive reports consist only of a
single warning message<br class="gmail_msg">
+ /// in a specific location, and perhaps extra
notes.<br class="gmail_msg">
+ /// Path-sensitive checkers are allowed to throw
path-insensitive reports.<br class="gmail_msg">
+ bool isPathSensitive() const { return ErrorNode !=
nullptr; }<br class="gmail_msg">
+<br class="gmail_msg">
const ExplodedNode *getErrorNode() const { return
ErrorNode; }<br class="gmail_msg">
<br class="gmail_msg">
StringRef getDescription() const { return
Description; }<br class="gmail_msg">
@@ -245,7 +260,27 @@ public:<br class="gmail_msg">
void setDeclWithIssue(const Decl *declWithIssue) {<br class="gmail_msg">
DeclWithIssue = declWithIssue;<br class="gmail_msg">
}<br class="gmail_msg">
-<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Add new item to the list of additional notes
that need to be attached to<br class="gmail_msg">
+ /// this path-insensitive report. If you want to
add extra notes to a<br class="gmail_msg">
+ /// path-sensitive report, you need to use a
BugReporterVisitor because it<br class="gmail_msg">
+ /// allows you to specify where exactly in the
auto-generated path diagnostic<br class="gmail_msg">
+ /// the extra note should appear.<br class="gmail_msg">
+ void addNote(StringRef Msg, const
PathDiagnosticLocation &Pos,<br class="gmail_msg">
+ ArrayRef<SourceRange>
Ranges = {}) {<br class="gmail_msg">
+ PathDiagnosticNotePiece *P =<br class="gmail_msg">
+ new PathDiagnosticNotePiece(Pos, Msg);<br class="gmail_msg">
+<br class="gmail_msg">
+ for (const auto &R : Ranges)<br class="gmail_msg">
+ P->addRange(R);<br class="gmail_msg">
+<br class="gmail_msg">
+ Notes.push_back(P);<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ virtual const NoteList &getNotes() {<br class="gmail_msg">
+ return Notes;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
/// \brief This allows for addition of meta data to
the diagnostic.<br class="gmail_msg">
///<br class="gmail_msg">
/// Currently, only the HTMLDiagnosticClient knows
how to display it.<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
(original)<br class="gmail_msg">
+++
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -336,7 +336,7 @@ public:<br class="gmail_msg">
<br class="gmail_msg">
class PathDiagnosticPiece : public RefCountedBaseVPTR
{<br class="gmail_msg">
public:<br class="gmail_msg">
- enum Kind { ControlFlow, Event, Macro, Call };<br class="gmail_msg">
+ enum Kind { ControlFlow, Event, Macro, Call, Note
};<br class="gmail_msg">
enum DisplayHint { Above, Below };<br class="gmail_msg">
<br class="gmail_msg">
private:<br class="gmail_msg">
@@ -452,7 +452,8 @@ public:<br class="gmail_msg">
void Profile(llvm::FoldingSetNodeID &ID) const
override;<br class="gmail_msg">
<br class="gmail_msg">
static bool classof(const PathDiagnosticPiece *P) {<br class="gmail_msg">
- return P->getKind() == Event ||
P->getKind() == Macro;<br class="gmail_msg">
+ return P->getKind() == Event ||
P->getKind() == Macro ||<br class="gmail_msg">
+ P->getKind() == Note;<br class="gmail_msg">
}<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
@@ -706,6 +707,23 @@ public:<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
void dump() const override;<br class="gmail_msg">
+<br class="gmail_msg">
+ void Profile(llvm::FoldingSetNodeID &ID) const
override;<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
+class PathDiagnosticNotePiece: public
PathDiagnosticSpotPiece {<br class="gmail_msg">
+public:<br class="gmail_msg">
+ PathDiagnosticNotePiece(const
PathDiagnosticLocation &Pos, StringRef S,<br class="gmail_msg">
+ bool AddPosRange =
true)<br class="gmail_msg">
+ : PathDiagnosticSpotPiece(Pos, S, Note,
AddPosRange) {}<br class="gmail_msg">
+<br class="gmail_msg">
+ ~PathDiagnosticNotePiece() override;<br class="gmail_msg">
+<br class="gmail_msg">
+ static inline bool classof(const
PathDiagnosticPiece *P) {<br class="gmail_msg">
+ return P->getKind() == Note;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ void dump() const override;<br class="gmail_msg">
<br class="gmail_msg">
void Profile(llvm::FoldingSetNodeID &ID) const
override;<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Mon Oct 3
02:58:26 2016<br class="gmail_msg">
@@ -324,6 +324,7 @@ void
html::AddHeaderFooterInternalBuilti<br class="gmail_msg">
" .msgT { padding:0x; spacing:0x }\n"<br class="gmail_msg">
" .msgEvent { background-color:#fff8b4;
color:#000000 }\n"<br class="gmail_msg">
" .msgControl { background-color:#bbbbbb;
color:#000000 }\n"<br class="gmail_msg">
+ " .msgNote { background-color:#ddeeff;
color:#000000 }\n"<br class="gmail_msg">
" .mrange { background-color:#dfddf3 }\n"<br class="gmail_msg">
" .mrange { border-bottom:1px solid #6F9DBE
}\n"<br class="gmail_msg">
" .PathIndex { font-weight: bold; padding:0px
5px; "<br class="gmail_msg">
@@ -343,8 +344,12 @@ void
html::AddHeaderFooterInternalBuilti<br class="gmail_msg">
" border-collapse: collapse; border-spacing:
0px;\n"<br class="gmail_msg">
" }\n"<br class="gmail_msg">
" td.rowname {\n"<br class="gmail_msg">
- " text-align:right; font-weight:bold;
color:#444444;\n"<br class="gmail_msg">
- " padding-right:2ex; }\n"<br class="gmail_msg">
+ " text-align: right;\n"<br class="gmail_msg">
+ " vertical-align: top;\n"<br class="gmail_msg">
+ " font-weight: bold;\n"<br class="gmail_msg">
+ " color:#444444;\n"<br class="gmail_msg">
+ " padding-right:2ex;\n"<br class="gmail_msg">
+ " }\n"<br class="gmail_msg">
"</style>\n</head>\n<body>";<br class="gmail_msg">
<br class="gmail_msg">
// Generate header<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
(original)<br class="gmail_msg">
+++
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -344,3 +344,10 @@ bool
AnalyzerOptions::shouldWidenLoops()<br class="gmail_msg">
WidenLoops = getBooleanOption("widen-loops",
/*Default=*/false);<br class="gmail_msg">
return WidenLoops.getValue();<br class="gmail_msg">
}<br class="gmail_msg">
+<br class="gmail_msg">
+bool AnalyzerOptions::shouldDisplayNotesAsEvents() {<br class="gmail_msg">
+ if (!DisplayNotesAsEvents.hasValue())<br class="gmail_msg">
+ DisplayNotesAsEvents =<br class="gmail_msg">
+ getBooleanOption("notes-as-events",
/*Default=*/false);<br class="gmail_msg">
+ return DisplayNotesAsEvents.getValue();<br class="gmail_msg">
+}<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
(original)<br class="gmail_msg">
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -112,15 +112,15 @@ static void
removeRedundantMsgs(PathPiec<br class="gmail_msg">
path.pop_front();<br class="gmail_msg">
<br class="gmail_msg">
switch (piece->getKind()) {<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Call:<br class="gmail_msg">
+ case PathDiagnosticPiece::Call:<br class="gmail_msg">
removeRedundantMsgs(cast<PathDiagnosticCallPiece>(piece)->path);<br class="gmail_msg">
break;<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Macro:<br class="gmail_msg">
+ case PathDiagnosticPiece::Macro:<br class="gmail_msg">
removeRedundantMsgs(cast<PathDiagnosticMacroPiece>(piece)->subPieces);<br class="gmail_msg">
break;<br class="gmail_msg">
- case
clang::ento::PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
+ case PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
break;<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Event: {<br class="gmail_msg">
+ case PathDiagnosticPiece::Event: {<br class="gmail_msg">
if (i == N-1)<br class="gmail_msg">
break;<br class="gmail_msg">
<br class="gmail_msg">
@@ -140,6 +140,8 @@ static void
removeRedundantMsgs(PathPiec<br class="gmail_msg">
}<br class="gmail_msg">
break;<br class="gmail_msg">
}<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
+ break;<br class="gmail_msg">
}<br class="gmail_msg">
path.push_back(piece);<br class="gmail_msg">
}<br class="gmail_msg">
@@ -197,6 +199,9 @@ static bool
removeUnneededCalls(PathPiec<br class="gmail_msg">
}<br class="gmail_msg">
case PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
break;<br class="gmail_msg">
+<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
+ break;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
pieces.push_back(piece);<br class="gmail_msg">
@@ -3403,25 +3408,28 @@ void
BugReporter::FlushReport(BugReport<br class="gmail_msg">
exampleReport->getUniqueingLocation(),<br class="gmail_msg">
exampleReport->getUniqueingDecl()));<br class="gmail_msg">
<br class="gmail_msg">
- MaxBugClassSize = std::max(bugReports.size(),<br class="gmail_msg">
-
static_cast<size_t>(MaxBugClassSize));<br class="gmail_msg">
+ if (exampleReport->isPathSensitive()) {<br class="gmail_msg">
+ // Generate the full path diagnostic, using the
generation scheme<br class="gmail_msg">
+ // specified by the PathDiagnosticConsumer. Note
that we have to generate<br class="gmail_msg">
+ // path diagnostics even for consumers which do
not support paths, because<br class="gmail_msg">
+ // the BugReporterVisitors may mark this bug as a
false positive.<br class="gmail_msg">
+ assert(!bugReports.empty());<br class="gmail_msg">
+<br class="gmail_msg">
+ MaxBugClassSize =<br class="gmail_msg">
+ std::max(bugReports.size(),
static_cast<size_t>(MaxBugClassSize));<br class="gmail_msg">
<br class="gmail_msg">
- // Generate the full path diagnostic, using the
generation scheme<br class="gmail_msg">
- // specified by the PathDiagnosticConsumer. Note
that we have to generate<br class="gmail_msg">
- // path diagnostics even for consumers which do not
support paths, because<br class="gmail_msg">
- // the BugReporterVisitors may mark this bug as a
false positive.<br class="gmail_msg">
- if (!bugReports.empty())<br class="gmail_msg">
if (!generatePathDiagnostic(*D.get(), PD,
bugReports))<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
- MaxValidBugClassSize = std::max(bugReports.size(),<br class="gmail_msg">
-
static_cast<size_t>(MaxValidBugClassSize));<br class="gmail_msg">
+ MaxValidBugClassSize =<br class="gmail_msg">
+ std::max(bugReports.size(),
static_cast<size_t>(MaxValidBugClassSize));<br class="gmail_msg">
<br class="gmail_msg">
- // Examine the report and see if the last piece is
in a header. Reset the<br class="gmail_msg">
- // report location to the last piece in the main
source file.<br class="gmail_msg">
- AnalyzerOptions& Opts = getAnalyzerOptions();<br class="gmail_msg">
- if (Opts.shouldReportIssuesInMainSourceFile()
&& !Opts.AnalyzeAll)<br class="gmail_msg">
- D->resetDiagnosticLocationToMainFile();<br class="gmail_msg">
+ // Examine the report and see if the last piece
is in a header. Reset the<br class="gmail_msg">
+ // report location to the last piece in the main
source file.<br class="gmail_msg">
+ AnalyzerOptions &Opts = getAnalyzerOptions();<br class="gmail_msg">
+ if (Opts.shouldReportIssuesInMainSourceFile()
&& !Opts.AnalyzeAll)<br class="gmail_msg">
+ D->resetDiagnosticLocationToMainFile();<br class="gmail_msg">
+ }<br class="gmail_msg">
<br class="gmail_msg">
// If the path is empty, generate a single step
path with the location<br class="gmail_msg">
// of the issue.<br class="gmail_msg">
@@ -3434,6 +3442,27 @@ void
BugReporter::FlushReport(BugReport<br class="gmail_msg">
D->setEndOfPath(std::move(piece));<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+ PathPieces &Pieces = D->getMutablePieces();<br class="gmail_msg">
+ if
(getAnalyzerOptions().shouldDisplayNotesAsEvents()) {<br class="gmail_msg">
+ // For path diagnostic consumers that don't
support extra notes,<br class="gmail_msg">
+ // we may optionally convert those to path notes.<br class="gmail_msg">
+ for (auto I =
exampleReport->getNotes().rbegin(),<br class="gmail_msg">
+ E =
exampleReport->getNotes().rend(); I != E; ++I) {<br class="gmail_msg">
+ PathDiagnosticNotePiece *Piece = I->get();<br class="gmail_msg">
+ PathDiagnosticEventPiece *ConvertedPiece =<br class="gmail_msg">
+ new
PathDiagnosticEventPiece(Piece->getLocation(),<br class="gmail_msg">
+
Piece->getString());<br class="gmail_msg">
+ for (const auto &R: Piece->getRanges())<br class="gmail_msg">
+ ConvertedPiece->addRange(R);<br class="gmail_msg">
+<br class="gmail_msg">
+ Pieces.push_front(ConvertedPiece);<br class="gmail_msg">
+ }<br class="gmail_msg">
+ } else {<br class="gmail_msg">
+ for (auto I =
exampleReport->getNotes().rbegin(),<br class="gmail_msg">
+ E =
exampleReport->getNotes().rend(); I != E; ++I)<br class="gmail_msg">
+ Pieces.push_front(*I);<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
// Get the meta data.<br class="gmail_msg">
const BugReport::ExtraTextList &Meta =
exampleReport->getExtraText();<br class="gmail_msg">
for (BugReport::ExtraTextList::const_iterator i =
Meta.begin(),<br class="gmail_msg">
@@ -3518,6 +3547,13 @@ LLVM_DUMP_METHOD void
PathDiagnosticMacr<br class="gmail_msg">
// FIXME: Print which macro is being invoked.<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+LLVM_DUMP_METHOD void PathDiagnosticNotePiece::dump()
const {<br class="gmail_msg">
+ llvm::errs() << "NOTE\n--------------\n";<br class="gmail_msg">
+ llvm::errs() << getString() << "\n";<br class="gmail_msg">
+ llvm::errs() << " ---- at ----\n";<br class="gmail_msg">
+ getLocation().dump();<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
LLVM_DUMP_METHOD void PathDiagnosticLocation::dump()
const {<br class="gmail_msg">
if (!isValid()) {<br class="gmail_msg">
llvm::errs() << "<INVALID>\n";<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
(original)<br class="gmail_msg">
+++
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -152,13 +152,30 @@ void
HTMLDiagnostics::ReportDiag(const P<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
// Process the path.<br class="gmail_msg">
- unsigned n = path.size();<br class="gmail_msg">
- unsigned max = n;<br class="gmail_msg">
-<br class="gmail_msg">
- for (PathPieces::const_reverse_iterator I =
path.rbegin(),<br class="gmail_msg">
- E = path.rend();<br class="gmail_msg">
- I != E; ++I, --n)<br class="gmail_msg">
- HandlePiece(R, FID, **I, n, max);<br class="gmail_msg">
+ // Maintain the counts of extra note pieces
separately.<br class="gmail_msg">
+ unsigned TotalPieces = path.size();<br class="gmail_msg">
+ unsigned TotalNotePieces =<br class="gmail_msg">
+ std::count_if(path.begin(), path.end(),<br class="gmail_msg">
+ [](const
IntrusiveRefCntPtr<PathDiagnosticPiece> &p)
{<br class="gmail_msg">
+ return
isa<PathDiagnosticNotePiece>(p.get());<br class="gmail_msg">
+ });<br class="gmail_msg">
+<br class="gmail_msg">
+ unsigned TotalRegularPieces = TotalPieces -
TotalNotePieces;<br class="gmail_msg">
+ unsigned NumRegularPieces = TotalRegularPieces;<br class="gmail_msg">
+ unsigned NumNotePieces = TotalNotePieces;<br class="gmail_msg">
+<br class="gmail_msg">
+ for (auto I = path.rbegin(), E = path.rend(); I !=
E; ++I) {<br class="gmail_msg">
+ if
(isa<PathDiagnosticNotePiece>(I->get())) {<br class="gmail_msg">
+ // This adds diagnostic bubbles, but not
navigation.<br class="gmail_msg">
+ // Navigation through note pieces would be
added later,<br class="gmail_msg">
+ // as a separate pass through the piece list.<br class="gmail_msg">
+ HandlePiece(R, FID, **I, NumNotePieces,
TotalNotePieces);<br class="gmail_msg">
+ --NumNotePieces;<br class="gmail_msg">
+ } else {<br class="gmail_msg">
+ HandlePiece(R, FID, **I, NumRegularPieces,
TotalRegularPieces);<br class="gmail_msg">
+ --NumRegularPieces;<br class="gmail_msg">
+ }<br class="gmail_msg">
+ }<br class="gmail_msg">
<br class="gmail_msg">
// Add line numbers, header, footer, etc.<br class="gmail_msg">
<br class="gmail_msg">
@@ -192,24 +209,38 @@ void
HTMLDiagnostics::ReportDiag(const P<br class="gmail_msg">
int ColumnNumber =
path.back()->getLocation().asLocation().getExpansionColumnNumber();<br class="gmail_msg">
<br class="gmail_msg">
// Add the name of the file as an <h1> tag.<br class="gmail_msg">
-<br class="gmail_msg">
{<br class="gmail_msg">
std::string s;<br class="gmail_msg">
llvm::raw_string_ostream os(s);<br class="gmail_msg">
<br class="gmail_msg">
os << "<!-- REPORTHEADER -->\n"<br class="gmail_msg">
- << "<h3>Bug
Summary</h3>\n<table
class=\"simpletable\">\n"<br class="gmail_msg">
+ << "<h3>Bug
Summary</h3>\n<table
class=\"simpletable\">\n"<br class="gmail_msg">
"<tr><td
class=\"rowname\">File:</td><td>"<br class="gmail_msg">
- << html::EscapeText(DirName)<br class="gmail_msg">
- << html::EscapeText(Entry->getName())<br class="gmail_msg">
- <<
"</td></tr>\n<tr><td
class=\"rowname\">Location:</td><td>"<br class="gmail_msg">
- "<a href=\"#EndPath\">line "<br class="gmail_msg">
- << LineNumber<br class="gmail_msg">
- << ", column "<br class="gmail_msg">
- << ColumnNumber<br class="gmail_msg">
- << "</a></td></tr>\n"<br class="gmail_msg">
- "<tr><td
class=\"rowname\">Description:</td><td>"<br class="gmail_msg">
- << D.getVerboseDescription() <<
"</td></tr>\n";<br class="gmail_msg">
+ << html::EscapeText(DirName)<br class="gmail_msg">
+ << html::EscapeText(Entry->getName())<br class="gmail_msg">
+ <<
"</td></tr>\n<tr><td
class=\"rowname\">Warning:</td><td>"<br class="gmail_msg">
+ "<a href=\"#EndPath\">line "<br class="gmail_msg">
+ << LineNumber<br class="gmail_msg">
+ << ", column "<br class="gmail_msg">
+ << ColumnNumber<br class="gmail_msg">
+ << "</a><br />"<br class="gmail_msg">
+ << D.getVerboseDescription() <<
"</td></tr>\n";<br class="gmail_msg">
+<br class="gmail_msg">
+ // The navigation across the extra notes pieces.<br class="gmail_msg">
+ unsigned NumExtraPieces = 0;<br class="gmail_msg">
+ for (const auto &Piece : path) {<br class="gmail_msg">
+ if (const auto *P =
dyn_cast<PathDiagnosticNotePiece>(Piece.get()))
{<br class="gmail_msg">
+ int LineNumber =<br class="gmail_msg">
+
P->getLocation().asLocation().getExpansionLineNumber();<br class="gmail_msg">
+ int ColumnNumber =<br class="gmail_msg">
+
P->getLocation().asLocation().getExpansionColumnNumber();<br class="gmail_msg">
+ os << "<tr><td
class=\"rowname\">Note:</td><td>"<br class="gmail_msg">
+ << "<a href=\"#Note" <<
NumExtraPieces << "\">line "<br class="gmail_msg">
+ << LineNumber << ", column "
<< ColumnNumber << "</a><br
/>"<br class="gmail_msg">
+ << P->getString() <<
"</td></tr>";<br class="gmail_msg">
+ ++NumExtraPieces;<br class="gmail_msg">
+ }<br class="gmail_msg">
+ }<br class="gmail_msg">
<br class="gmail_msg">
// Output any other meta data.<br class="gmail_msg">
<br class="gmail_msg">
@@ -385,13 +416,20 @@ void
HTMLDiagnostics::HandlePiece(Rewrit<br class="gmail_msg">
// Create the html for the message.<br class="gmail_msg">
<br class="gmail_msg">
const char *Kind = nullptr;<br class="gmail_msg">
+ bool IsNote = false;<br class="gmail_msg">
+ bool SuppressIndex = (max == 1);<br class="gmail_msg">
switch (P.getKind()) {<br class="gmail_msg">
case PathDiagnosticPiece::Call:<br class="gmail_msg">
- llvm_unreachable("Calls should already be
handled");<br class="gmail_msg">
+ llvm_unreachable("Calls and extra notes should
already be handled");<br class="gmail_msg">
case PathDiagnosticPiece::Event: Kind = "Event";
break;<br class="gmail_msg">
case PathDiagnosticPiece::ControlFlow: Kind =
"Control"; break;<br class="gmail_msg">
// Setting Kind to "Control" is intentional.<br class="gmail_msg">
case PathDiagnosticPiece::Macro: Kind = "Control";
break;<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
+ Kind = "Note";<br class="gmail_msg">
+ IsNote = true;<br class="gmail_msg">
+ SuppressIndex = true;<br class="gmail_msg">
+ break;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
std::string sbuf;<br class="gmail_msg">
@@ -399,7 +437,9 @@ void
HTMLDiagnostics::HandlePiece(Rewrit<br class="gmail_msg">
<br class="gmail_msg">
os << "\n<tr><td
class=\"num\"></td><td
class=\"line\"><div id=\"";<br class="gmail_msg">
<br class="gmail_msg">
- if (num == max)<br class="gmail_msg">
+ if (IsNote)<br class="gmail_msg">
+ os << "Note" << num;<br class="gmail_msg">
+ else if (num == max)<br class="gmail_msg">
os << "EndPath";<br class="gmail_msg">
else<br class="gmail_msg">
os << "Path" << num;<br class="gmail_msg">
@@ -461,7 +501,7 @@ void
HTMLDiagnostics::HandlePiece(Rewrit<br class="gmail_msg">
<br class="gmail_msg">
os << "\">";<br class="gmail_msg">
<br class="gmail_msg">
- if (max > 1) {<br class="gmail_msg">
+ if (!SuppressIndex) {<br class="gmail_msg">
os << "<table
class=\"msgT\"><tr><td
valign=\"top\">";<br class="gmail_msg">
os << "<div class=\"PathIndex";<br class="gmail_msg">
if (Kind) os << " PathIndex" << Kind;<br class="gmail_msg">
@@ -501,7 +541,7 @@ void
HTMLDiagnostics::HandlePiece(Rewrit<br class="gmail_msg">
<br class="gmail_msg">
os << "':\n";<br class="gmail_msg">
<br class="gmail_msg">
- if (max > 1) {<br class="gmail_msg">
+ if (!SuppressIndex) {<br class="gmail_msg">
os << "</td>";<br class="gmail_msg">
if (num < max) {<br class="gmail_msg">
os << "<td><div
class=\"PathNav\"><a href=\"#";<br class="gmail_msg">
@@ -523,7 +563,7 @@ void
HTMLDiagnostics::HandlePiece(Rewrit<br class="gmail_msg">
else {<br class="gmail_msg">
os << html::EscapeText(P.getString());<br class="gmail_msg">
<br class="gmail_msg">
- if (max > 1) {<br class="gmail_msg">
+ if (!SuppressIndex) {<br class="gmail_msg">
os << "</td>";<br class="gmail_msg">
if (num < max) {<br class="gmail_msg">
os << "<td><div
class=\"PathNav\"><a href=\"#";<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
(original)<br class="gmail_msg">
+++
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -60,6 +60,7 @@
PathDiagnosticEventPiece::~PathDiagnosti<br class="gmail_msg">
PathDiagnosticCallPiece::~PathDiagnosticCallPiece()
{}<br class="gmail_msg">
PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {}<br class="gmail_msg">
PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece()
{}<br class="gmail_msg">
+PathDiagnosticNotePiece::~PathDiagnosticNotePiece()
{}<br class="gmail_msg">
<br class="gmail_msg">
void PathPieces::flattenTo(PathPieces &Primary,
PathPieces &Current,<br class="gmail_msg">
bool ShouldFlattenMacros)
const {<br class="gmail_msg">
@@ -95,6 +96,7 @@ void
PathPieces::flattenTo(PathPieces &P<br class="gmail_msg">
}<br class="gmail_msg">
case PathDiagnosticPiece::Event:<br class="gmail_msg">
case PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
Current.push_back(Piece);<br class="gmail_msg">
break;<br class="gmail_msg">
}<br class="gmail_msg">
@@ -342,15 +344,16 @@ static Optional<bool>
comparePiece(const<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
switch (X.getKind()) {<br class="gmail_msg">
- case
clang::ento::PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
+ case PathDiagnosticPiece::ControlFlow:<br class="gmail_msg">
return
compareControlFlow(cast<PathDiagnosticControlFlowPiece>(X),<br class="gmail_msg">
cast<PathDiagnosticControlFlowPiece>(Y));<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Event:<br class="gmail_msg">
+ case PathDiagnosticPiece::Event:<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
return None;<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Macro:<br class="gmail_msg">
+ case PathDiagnosticPiece::Macro:<br class="gmail_msg">
return
compareMacro(cast<PathDiagnosticMacroPiece>(X),<br class="gmail_msg">
cast<PathDiagnosticMacroPiece>(Y));<br class="gmail_msg">
- case clang::ento::PathDiagnosticPiece::Call:<br class="gmail_msg">
+ case PathDiagnosticPiece::Call:<br class="gmail_msg">
return
compareCall(cast<PathDiagnosticCallPiece>(X),<br class="gmail_msg">
cast<PathDiagnosticCallPiece>(Y));<br class="gmail_msg">
}<br class="gmail_msg">
@@ -1098,6 +1101,10 @@ void
PathDiagnosticMacroPiece::Profile(l<br class="gmail_msg">
ID.Add(**I);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+void
PathDiagnosticNotePiece::Profile(llvm::FoldingSetNodeID
&ID) const {<br class="gmail_msg">
+ PathDiagnosticSpotPiece::Profile(ID);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
void PathDiagnostic::Profile(llvm::FoldingSetNodeID
&ID) const {<br class="gmail_msg">
ID.Add(getLocation());<br class="gmail_msg">
ID.AddString(BugType);<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
(original)<br class="gmail_msg">
+++
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -281,6 +281,9 @@ static void
ReportPiece(raw_ostream &o,<br class="gmail_msg">
ReportMacro(o,
cast<PathDiagnosticMacroPiece>(P), FM, SM,
LangOpts,<br class="gmail_msg">
indent, depth);<br class="gmail_msg">
break;<br class="gmail_msg">
+ case PathDiagnosticPiece::Note:<br class="gmail_msg">
+ // FIXME: Extend the plist format to support
those.<br class="gmail_msg">
+ break;<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified:
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=283092&r1=283091&r2=283092&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=283092&r1=283091&r2=283092&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
---
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
(original)<br class="gmail_msg">
+++
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
Mon Oct 3 02:58:26 2016<br class="gmail_msg">
@@ -113,16 +113,28 @@ public:<br class="gmail_msg">
Diag.Report(WarnLoc, WarnID) <<
PD->getShortDescription()<br class="gmail_msg">
<<
PD->path.back()->getRanges();<br class="gmail_msg">
<br class="gmail_msg">
+ // First, add extra notes, even if paths should
not be included.<br class="gmail_msg">
+ for (const auto &Piece : PD->path) {<br class="gmail_msg">
+ if
(!isa<PathDiagnosticNotePiece>(Piece.get()))<br class="gmail_msg">
+ continue;<br class="gmail_msg">
+<br class="gmail_msg">
+ SourceLocation NoteLoc =
Piece->getLocation().asLocation();<br class="gmail_msg">
+ Diag.Report(NoteLoc, NoteID) <<
Piece->getString()<br class="gmail_msg">
+ <<
Piece->getRanges();<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
if (!IncludePath)<br class="gmail_msg">
continue;<br class="gmail_msg">
<br class="gmail_msg">
+ // Then, add the path notes if necessary.<br class="gmail_msg">
PathPieces FlatPath =
PD->path.flatten(/*ShouldFlattenMacros=*/true);<br class="gmail_msg">
- for (PathPieces::const_iterator PI =
FlatPath.begin(),<br class="gmail_msg">
- PE =
FlatPath.end();<br class="gmail_msg">
- PI != PE; ++PI) {<br class="gmail_msg">
- SourceLocation NoteLoc =
(*PI)->getLocation().asLocation();<br class="gmail_msg">
- Diag.Report(NoteLoc, NoteID) <<
(*PI)->getString()<br class="gmail_msg">
- <<
(*PI)->getRanges();<br class="gmail_msg">
+ for (const auto &Piece : FlatPath) {<br class="gmail_msg">
+ if
(isa<PathDiagnosticNotePiece>(Piece.get()))<br class="gmail_msg">
+ continue;<br class="gmail_msg">
+<br class="gmail_msg">
+ SourceLocation NoteLoc =
Piece->getLocation().asLocation();<br class="gmail_msg">
+ Diag.Report(NoteLoc, NoteID) <<
Piece->getString()<br class="gmail_msg">
+ <<
Piece->getRanges();<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-commits mailing list<br class="gmail_msg">
<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="gmail_msg">
</blockquote>
</div>
<br class="gmail_msg">
<fieldset class="m_-2630513323378653476m_-1065106170221421501mimeAttachmentHeader gmail_msg"></fieldset>
<br class="gmail_msg">
<pre class="gmail_msg">_______________________________________________
cfe-commits mailing list
<a class="m_-2630513323378653476m_-1065106170221421501moz-txt-link-abbreviated gmail_msg" href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>
<a class="m_-2630513323378653476m_-1065106170221421501moz-txt-link-freetext gmail_msg" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a>
</pre>
</blockquote>
<br class="gmail_msg">
</div>
</blockquote>
</div>
</blockquote>
<br class="gmail_msg">
</div></blockquote></div>