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
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index 81f75bd..c8fd5f6 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 @@
}
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;