aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-05-04 21:55:25 +0000
committerChris Lattner <sabre@nondot.org>2010-05-04 21:55:25 +0000
commit6fbe8398ba1680ffc5daa7395850ff8765b7905b (patch)
tree0f90c54b1644a14788dbce898e7850fb9fbe7602 /lib/Frontend/TextDiagnosticPrinter.cpp
parentc9b889044c8e1e2d6ab194e34e8b74f6998094fa (diff)
add a new -fdiagnostics-show-category=none/id/name option, giving control
over choice of: t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat] t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1] t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Format String] dox to come. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 46bdd75a0e..547ff4d46b 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -837,7 +837,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
// If the user wants to see category information, include it too.
unsigned DiagCategory = 0;
- if (DiagOpts->ShowSourceRanges)
+ if (DiagOpts->ShowCategories)
DiagCategory = Diagnostic::getCategoryNumberForDiag(Info.getID());
// If there is any categorization information, include it.
@@ -852,7 +852,12 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
if (DiagCategory) {
if (NeedsComma) OutStr += ',';
- OutStr += llvm::utostr(DiagCategory);
+ if (DiagOpts->ShowCategories == 1)
+ OutStr += llvm::utostr(DiagCategory);
+ else {
+ assert(DiagOpts->ShowCategories == 2 && "Invalid ShowCategories value");
+ OutStr += Diagnostic::getCategoryNameFromID(DiagCategory);
+ }
}
OutStr += "]";