diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-04 21:55:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-04 21:55:25 +0000 |
commit | bf6fac84153fc2731c2894b9c12f574c663bff55 (patch) | |
tree | 7a33de7fb51f8970e5a06a6fb27ad597812cc5bc /clang/lib/Frontend/TextDiagnosticPrinter.cpp | |
parent | 4531cc55291815d7c3036486d553ea8b6c744f2f (diff) | |
download | bcm5719-llvm-bf6fac84153fc2731c2894b9c12f574c663bff55.tar.gz bcm5719-llvm-bf6fac84153fc2731c2894b9c12f574c663bff55.zip |
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.
llvm-svn: 103056
Diffstat (limited to 'clang/lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r-- | clang/lib/Frontend/TextDiagnosticPrinter.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index 46bdd75a0e0..547ff4d46b7 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/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 += "]"; |