diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-23 01:20:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-23 01:20:39 +0000 |
commit | 8ea841b1152308ae11c23a7836dead36e47d96e3 (patch) | |
tree | 1026d0035ae866a5702da537da94d031e4ad42a2 | |
parent | a43484afda4c4fb4b23a53a2dc91d985d39dc2c4 (diff) |
switch Warnings.cpp to use the diagnostics machinery to print diagnostics, not *fprintf*!
Among other things, this makes the warning about unknown warning options mappable.
For example:
$ clang t.c -Werror -Wfoo
error: unknown warning option '-Wfoo' [-Wunknown-warning-option]
For another thing, they are properly color coded now too :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73936 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 3 | ||||
-rw-r--r-- | lib/Frontend/Warnings.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index ae5246d792..9c439851b1 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -136,4 +136,7 @@ def warn_pch_char_signed : Error< def err_not_a_pch_file : Error< "'%0' does not appear to be a precompiled header file">, DefaultFatal; +def warn_unknown_warning_option : Warning< + "unknown warning option '%0'">, + InGroup<DiagGroup<"unknown-warning-option"> >; } diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp index 81f75bdf75..c8fd5f6fcb 100644 --- a/lib/Frontend/Warnings.cpp +++ b/lib/Frontend/Warnings.cpp @@ -24,6 +24,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Sema/SemaDiagnostic.h" #include "clang/Lex/LexDiagnostic.h" +#include "clang/Frontend/FrontendDiagnostic.h" #include <cstdio> #include <cstring> #include <utility> @@ -99,7 +100,8 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags, } if (Diags.setDiagnosticGroupMapping(OptStart, Mapping)) - fprintf(stderr, "warning: unknown warning option: -W%s\n", Opt.c_str()); + Diags.Report(FullSourceLoc(), diag::warn_unknown_warning_option) + << ("-W" + Opt); } return false; |