aboutsummaryrefslogtreecommitdiff
path: root/tools/clang-cc
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-12 07:28:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-12 07:28:44 +0000
commit6907943901e0aae5be7618c36c0f8275634e6ab5 (patch)
tree035e97bdc444a17340d84d479e198a13e82f7dc3 /tools/clang-cc
parentc706468b1e00bab49ca92eb500a39657f530f828 (diff)
Move warning options into DiagnosticOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-cc')
-rw-r--r--tools/clang-cc/Options.cpp23
-rw-r--r--tools/clang-cc/clang-cc.cpp28
2 files changed, 25 insertions, 26 deletions
diff --git a/tools/clang-cc/Options.cpp b/tools/clang-cc/Options.cpp
index 7c716406ce..de2122a892 100644
--- a/tools/clang-cc/Options.cpp
+++ b/tools/clang-cc/Options.cpp
@@ -245,6 +245,18 @@ NoDiagnosticsFixIt("fno-diagnostics-fixit-info",
llvm::cl::desc("Do not include fixit information in"
" diagnostics"));
+static llvm::cl::opt<bool> OptNoWarnings("w");
+
+static llvm::cl::opt<bool> OptPedantic("pedantic");
+
+static llvm::cl::opt<bool> OptPedanticErrors("pedantic-errors");
+
+// 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>
PrintSourceRangeInfo("fdiagnostics-print-source-range-info",
llvm::cl::desc("Print source range spans in numeric form"));
@@ -263,6 +275,10 @@ static llvm::cl::opt<bool>
PrintColorDiagnostic("fcolor-diagnostics",
llvm::cl::desc("Use colors in diagnostics"));
+static llvm::cl::opt<bool>
+SilenceRewriteMacroWarning("Wno-rewrite-macros", llvm::cl::init(false),
+ llvm::cl::desc("Silence ObjC rewriting warnings"));
+
}
//===----------------------------------------------------------------------===//
@@ -664,8 +680,14 @@ void clang::InitializeDependencyOutputOptions(DependencyOutputOptions &Opts) {
void clang::InitializeDiagnosticOptions(DiagnosticOptions &Opts) {
using namespace diagnosticoptions;
+ Opts.Warnings.insert(Opts.Warnings.begin(),
+ OptWarnings.begin(), OptWarnings.end());
Opts.DumpBuildInformation = DumpBuildInformation;
+ Opts.IgnoreWarnings = OptNoWarnings;
Opts.MessageLength = MessageLength;
+ Opts.NoRewriteMacros = SilenceRewriteMacroWarning;
+ Opts.Pedantic = OptPedantic;
+ Opts.PedanticErrors = OptPedanticErrors;
Opts.ShowCarets = !NoCaretDiagnostics;
Opts.ShowColors = PrintColorDiagnostic;
Opts.ShowColumn = !NoShowColumn;
@@ -1106,4 +1128,3 @@ clang::InitializePreprocessorOutputOptions(PreprocessorOutputOptions &Opts) {
Opts.ShowComments = EnableCommentOutput;
Opts.ShowMacroComments = EnableMacroCommentOutput;
}
-
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index f2b38401e7..ad55753527 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -428,28 +428,6 @@ FixItAtLocations("fixit-at", llvm::cl::value_desc("source-location"),
llvm::cl::desc("Perform Fix-It modifications at the given source location"));
//===----------------------------------------------------------------------===//
-// ObjC Rewriter Options
-//===----------------------------------------------------------------------===//
-
-static llvm::cl::opt<bool>
-SilenceRewriteMacroWarning("Wno-rewrite-macros", llvm::cl::init(false),
- 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
//===----------------------------------------------------------------------===//
@@ -596,7 +574,8 @@ static ASTConsumer *CreateConsumerAction(const CompilerInvocation &CompOpts,
case RewriteObjC:
OS.reset(ComputeOutFile(CompOpts, InFile, "cpp", true, OutPath));
return CreateObjCRewriter(InFile, OS.get(), PP.getDiagnostics(),
- PP.getLangOptions(), SilenceRewriteMacroWarning);
+ PP.getLangOptions(),
+ CompOpts.getDiagnosticOpts().NoRewriteMacros);
case RewriteBlocks:
return CreateBlockRewriter(InFile, PP.getDiagnostics(),
@@ -1079,8 +1058,7 @@ static Diagnostic *CreateDiagnosticEngine(const DiagnosticOptions &Opts,
// Configure our handling of diagnostics.
Diagnostic *Diags = new Diagnostic(DiagClient.take());
- if (ProcessWarningOptions(*Diags, OptWarnings, OptPedantic, OptPedanticErrors,
- OptNoWarnings))
+ if (ProcessWarningOptions(*Diags, Opts))
return 0;
// Set an error handler, so that any LLVM backend diagnostics go through our