[cfe-commits] r72089 - in /cfe/trunk/tools/clang-cc: Warnings.cpp clang-cc.cpp clang-cc.h
Eli Friedman
eli.friedman at gmail.com
Mon May 18 18:17:07 PDT 2009
Author: efriedma
Date: Mon May 18 20:17:04 2009
New Revision: 72089
URL: http://llvm.org/viewvc/llvm-project?rev=72089&view=rev
Log:
Move the warning options from Warnings.cpp to clang-cc.cpp.
Modified:
cfe/trunk/tools/clang-cc/Warnings.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
cfe/trunk/tools/clang-cc/clang-cc.h
Modified: cfe/trunk/tools/clang-cc/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Warnings.cpp?rev=72089&r1=72088&r2=72089&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Warnings.cpp (original)
+++ cfe/trunk/tools/clang-cc/Warnings.cpp Mon May 18 20:17:04 2009
@@ -30,34 +30,27 @@
#include <algorithm>
using namespace clang;
-// This gets all -W options, including -Werror, -W[no-]system-headers, etc. The
-// driver has stripped off -Wa,foo etc. The driver has also translated -W to
-// -Wextra, so we don't need to worry about it.
-static llvm::cl::list<std::string>
-OptWarnings("W", llvm::cl::Prefix, llvm::cl::ValueOptional);
-
-static llvm::cl::opt<bool> OptPedantic("pedantic");
-static llvm::cl::opt<bool> OptPedanticErrors("pedantic-errors");
-static llvm::cl::opt<bool> OptNoWarnings("w");
-
-bool clang::ProcessWarningOptions(Diagnostic &Diags) {
+bool clang::ProcessWarningOptions(Diagnostic &Diags,
+ std::vector<std::string> &Warnings,
+ bool Pedantic, bool PedanticErrors,
+ bool NoWarnings) {
Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers
- Diags.setIgnoreAllWarnings(OptNoWarnings);
+ Diags.setIgnoreAllWarnings(NoWarnings);
// If -pedantic or -pedantic-errors was specified, then we want to map all
// extension diagnostics onto WARNING or ERROR unless the user has futz'd
// around with them explicitly.
- if (OptPedanticErrors)
+ if (PedanticErrors)
Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Error);
- else if (OptPedantic)
+ else if (Pedantic)
Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Warn);
else
Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore);
// FIXME: -Wfatal-errors / -Wfatal-errors=foo
- for (unsigned i = 0, e = OptWarnings.size(); i != e; ++i) {
- const std::string &Opt = OptWarnings[i];
+ for (unsigned i = 0, e = Warnings.size(); i != e; ++i) {
+ const std::string &Opt = Warnings[i];
const char *OptStart = &Opt[0];
const char *OptEnd = OptStart+Opt.size();
assert(*OptEnd == 0 && "Expect null termination for lower-bound search");
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=72089&r1=72088&r2=72089&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Mon May 18 20:17:04 2009
@@ -1497,6 +1497,20 @@
llvm::cl::desc("Silence ObjC rewriting warnings"));
//===----------------------------------------------------------------------===//
+// Warning Options
+//===----------------------------------------------------------------------===//
+
+// This gets all -W options, including -Werror, -W[no-]system-headers, etc. The
+// driver has stripped off -Wa,foo etc. The driver has also translated -W to
+// -Wextra, so we don't need to worry about it.
+static llvm::cl::list<std::string>
+OptWarnings("W", llvm::cl::Prefix, llvm::cl::ValueOptional);
+
+static llvm::cl::opt<bool> OptPedantic("pedantic");
+static llvm::cl::opt<bool> OptPedanticErrors("pedantic-errors");
+static llvm::cl::opt<bool> OptNoWarnings("w");
+
+//===----------------------------------------------------------------------===//
// -dump-build-information Stuff
//===----------------------------------------------------------------------===//
@@ -2028,7 +2042,8 @@
// Configure our handling of diagnostics.
Diagnostic Diags(DiagClient.get());
- if (ProcessWarningOptions(Diags))
+ if (ProcessWarningOptions(Diags, OptWarnings, OptPedantic, OptPedanticErrors,
+ OptNoWarnings))
return 1;
// -I- is a deprecated GCC feature, scan for it and reject it.
Modified: cfe/trunk/tools/clang-cc/clang-cc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.h?rev=72089&r1=72088&r2=72089&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.h (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.h Mon May 18 20:17:04 2009
@@ -35,7 +35,10 @@
/// ProcessWarningOptions - Initialize the diagnostic client and process the
/// warning options specified on the command line.
-bool ProcessWarningOptions(Diagnostic &Diags);
+bool ProcessWarningOptions(Diagnostic &Diags,
+ std::vector<std::string> &Warnings,
+ bool Pedantic, bool PedanticErrors,
+ bool NoWarnings);
/// DoPrintPreprocessedInput - Implement -E mode.
void DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream* OS);
More information about the cfe-commits
mailing list