summaryrefslogtreecommitdiffstats
path: root/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/StaticAnalyzer/Core/PlistDiagnostics.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/PlistDiagnostics.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
index a2c66f8..e0aff58 100644
--- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -37,7 +37,7 @@ namespace {
const LangOptions &LangOpts,
bool supportsMultipleFiles);
- virtual ~PlistDiagnostics() {}
+ ~PlistDiagnostics() override {}
void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
FilesMade *filesMade) override;
@@ -106,13 +106,14 @@ static void ReportControlFlow(raw_ostream &o,
// by forcing to use only the beginning of the range. This simplifies the layout
// logic for clients.
Indent(o, indent) << "<key>start</key>\n";
- SourceLocation StartEdge = I->getStart().asRange().getBegin();
- EmitRange(o, SM, LangOpts, CharSourceRange::getTokenRange(StartEdge), FM,
+ SourceRange StartEdge(
+ SM.getExpansionLoc(I->getStart().asRange().getBegin()));
+ EmitRange(o, SM, Lexer::getAsCharRange(StartEdge, SM, LangOpts), FM,
indent + 1);
Indent(o, indent) << "<key>end</key>\n";
- SourceLocation EndEdge = I->getEnd().asRange().getBegin();
- EmitRange(o, SM, LangOpts, CharSourceRange::getTokenRange(EndEdge), FM,
+ SourceRange EndEdge(SM.getExpansionLoc(I->getEnd().asRange().getBegin()));
+ EmitRange(o, SM, Lexer::getAsCharRange(EndEdge, SM, LangOpts), FM,
indent + 1);
--indent;
@@ -154,7 +155,7 @@ static void ReportEvent(raw_ostream &o, const PathDiagnosticPiece& P,
FullSourceLoc L = P.getLocation().asLocation();
Indent(o, indent) << "<key>location</key>\n";
- EmitLocation(o, SM, LangOpts, L, FM, indent);
+ EmitLocation(o, SM, L, FM, indent);
// Output the ranges (if any).
ArrayRef<SourceRange> Ranges = P.getRanges();
@@ -163,11 +164,10 @@ static void ReportEvent(raw_ostream &o, const PathDiagnosticPiece& P,
Indent(o, indent) << "<key>ranges</key>\n";
Indent(o, indent) << "<array>\n";
++indent;
- for (ArrayRef<SourceRange>::iterator I = Ranges.begin(), E = Ranges.end();
- I != E; ++I) {
- EmitRange(o, SM, LangOpts, CharSourceRange::getTokenRange(*I), FM,
- indent + 1);
- }
+ for (auto &R : Ranges)
+ EmitRange(o, SM,
+ Lexer::getAsCharRange(SM.getExpansionRange(R), SM, LangOpts),
+ FM, indent + 1);
--indent;
Indent(o, indent) << "</array>\n";
}
@@ -387,7 +387,9 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
EmitString(o, D->getCategory()) << '\n';
o << " <key>type</key>";
EmitString(o, D->getBugType()) << '\n';
-
+ o << " <key>check_name</key>";
+ EmitString(o, D->getCheckName()) << '\n';
+
// Output information about the semantic context where
// the issue occurred.
if (const Decl *DeclWithIssue = D->getDeclWithIssue()) {
@@ -453,7 +455,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
// Output the location of the bug.
o << " <key>location</key>\n";
- EmitLocation(o, *SM, LangOpts, D->getLocation().asLocation(), FM, 2);
+ EmitLocation(o, *SM, D->getLocation().asLocation(), FM, 2);
// Output the diagnostic to the sub-diagnostic client, if any.
if (!filesMade->empty()) {
OpenPOWER on IntegriCloud