Handle "Macro" PathDiagnosticPiece kind when getting string identifier.

llvm-svn: 66518
This commit is contained in:
Ted Kremenek 2009-03-10 02:49:29 +00:00
parent 7ea58c355b
commit 493a4242d9
2 changed files with 11 additions and 8 deletions

View File

@ -159,8 +159,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
// Create a new rewriter to generate HTML.
Rewriter R(SMgr);
// Process the path.
// Process the path.
unsigned n = D.size();
unsigned max = n;
@ -376,7 +375,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
switch (*I) {
default:
++cnt;
continue;
continue;
case ' ':
case '\t':
case '\n':
@ -410,9 +409,9 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
// Now generate the message bubble.
const char *Kind = 0;
switch (P.getKind()) {
default: break;
case PathDiagnosticPiece::Event: Kind = "Event"; break;
case PathDiagnosticPiece::ControlFlow: Kind = "Control"; break;
case PathDiagnosticPiece::Macro: Kind = "Macro"; break;
}
std::string sbuf;

View File

@ -136,10 +136,14 @@ static void ReportDiag(llvm::raw_ostream& o, const PathDiagnosticPiece& P,
#endif
// Output the PathDiagnosticPiece::Kind.
Indent(o, indent) << "<key>kind</key>\n";
Indent(o, indent) << "<string>"
<< (P.getKind() == PathDiagnosticPiece::Event
? "Event" : "ControlFlow")
<< "</string>\n";
Indent(o, indent) << "<string>";
switch (P.getKind()) {
case PathDiagnosticPiece::Event: o << "Event"; break;
case PathDiagnosticPiece::ControlFlow: o << "ControlFlow"; break;
case PathDiagnosticPiece::Macro: o << "Macro"; break;
}
o << "</string>\n";
// Finish up.