[cfe-commits] r73936 - in /cfe/trunk: include/clang/Basic/DiagnosticFrontendKinds.td lib/Frontend/Warnings.cpp
Chris Lattner
sabre at nondot.org
Mon Jun 22 18:20:40 PDT 2009
Author: lattner
Date: Mon Jun 22 20:20:39 2009
New Revision: 73936
URL: http://llvm.org/viewvc/llvm-project?rev=73936&view=rev
Log:
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 :)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/lib/Frontend/Warnings.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=73936&r1=73935&r2=73936&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Jun 22 20:20:39 2009
@@ -136,4 +136,7 @@
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"> >;
}
Modified: cfe/trunk/lib/Frontend/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Warnings.cpp?rev=73936&r1=73935&r2=73936&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Warnings.cpp (original)
+++ cfe/trunk/lib/Frontend/Warnings.cpp Mon Jun 22 20:20:39 2009
@@ -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 @@
}
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;
More information about the cfe-commits
mailing list