[cfe-commits] r86819 - in /cfe/trunk/tools/clang-cc: Options.cpp Options.h clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 11 00:13:40 PST 2009
Author: ddunbar
Date: Wed Nov 11 02:13:40 2009
New Revision: 86819
URL: http://llvm.org/viewvc/llvm-project?rev=86819&view=rev
Log:
clang-cc: Move InitializeDiagnosticOptions to Options.cpp
Modified:
cfe/trunk/tools/clang-cc/Options.cpp
cfe/trunk/tools/clang-cc/Options.h
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/tools/clang-cc/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Options.cpp?rev=86819&r1=86818&r2=86819&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Options.cpp (original)
+++ cfe/trunk/tools/clang-cc/Options.cpp Wed Nov 11 02:13:40 2009
@@ -13,6 +13,7 @@
#include "Options.h"
#include "clang/Frontend/CompileOptions.h"
+#include "clang/Frontend/DiagnosticOptions.h"
#include "clang/Frontend/HeaderSearchOptions.h"
#include "clang/Frontend/PCHReader.h"
#include "clang/Frontend/PreprocessorOptions.h"
@@ -87,6 +88,51 @@
}
//===----------------------------------------------------------------------===//
+// Diagnostic Options
+//===----------------------------------------------------------------------===//
+
+namespace diagnosticoptions {
+
+static llvm::cl::opt<bool>
+NoShowColumn("fno-show-column",
+ llvm::cl::desc("Do not include column number on diagnostics"));
+
+static llvm::cl::opt<bool>
+NoShowLocation("fno-show-source-location",
+ llvm::cl::desc("Do not include source location information with"
+ " diagnostics"));
+
+static llvm::cl::opt<bool>
+NoCaretDiagnostics("fno-caret-diagnostics",
+ llvm::cl::desc("Do not include source line and caret with"
+ " diagnostics"));
+
+static llvm::cl::opt<bool>
+NoDiagnosticsFixIt("fno-diagnostics-fixit-info",
+ llvm::cl::desc("Do not include fixit information in"
+ " diagnostics"));
+
+static llvm::cl::opt<bool>
+PrintSourceRangeInfo("fdiagnostics-print-source-range-info",
+ llvm::cl::desc("Print source range spans in numeric form"));
+
+static llvm::cl::opt<bool>
+PrintDiagnosticOption("fdiagnostics-show-option",
+ llvm::cl::desc("Print diagnostic name with mappable diagnostics"));
+
+static llvm::cl::opt<unsigned>
+MessageLength("fmessage-length",
+ llvm::cl::desc("Format message diagnostics so that they fit "
+ "within N columns or fewer, when possible."),
+ llvm::cl::value_desc("N"));
+
+static llvm::cl::opt<bool>
+PrintColorDiagnostic("fcolor-diagnostics",
+ llvm::cl::desc("Use colors in diagnostics"));
+
+}
+
+//===----------------------------------------------------------------------===//
// Language Options
//===----------------------------------------------------------------------===//
@@ -250,7 +296,6 @@
llvm::cl::desc("Recognize and construct Pascal-style "
"string literals"));
-// FIXME: Move to CompileOptions.
static llvm::cl::opt<bool>
Rtti("frtti", llvm::cl::init(true),
llvm::cl::desc("Enable generation of rtti information"));
@@ -454,6 +499,19 @@
Opts.MergeAllConstants = !NoMergeConstants;
}
+void clang::InitializeDiagnosticOptions(DiagnosticOptions &Opts) {
+ using namespace diagnosticoptions;
+
+ Opts.ShowColumn = !NoShowColumn;
+ Opts.ShowLocation = !NoShowLocation;
+ Opts.ShowCarets = !NoCaretDiagnostics;
+ Opts.ShowFixits = !NoDiagnosticsFixIt;
+ Opts.ShowSourceRanges = PrintSourceRangeInfo;
+ Opts.ShowOptionNames = PrintDiagnosticOption;
+ Opts.ShowColors = PrintColorDiagnostic;
+ Opts.MessageLength = MessageLength;
+}
+
void clang::InitializeHeaderSearchOptions(HeaderSearchOptions &Opts,
llvm::StringRef BuiltinIncludePath,
bool Verbose,
Modified: cfe/trunk/tools/clang-cc/Options.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Options.h?rev=86819&r1=86818&r2=86819&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Options.h (original)
+++ cfe/trunk/tools/clang-cc/Options.h Wed Nov 11 02:13:40 2009
@@ -15,6 +15,7 @@
namespace clang {
class CompileOptions;
+class DiagnosticOptions;
class HeaderSearchOptions;
class LangOptions;
class PreprocessorOptions;
@@ -39,6 +40,8 @@
// before language initialization?
void ComputeFeatureMap(TargetInfo &Target, llvm::StringMap<bool> &Features);
+void InitializeDiagnosticOptions(DiagnosticOptions &Opts);
+
void InitializeCompileOptions(CompileOptions &Opts,
const llvm::StringMap<bool> &Features);
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=86819&r1=86818&r2=86819&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 02:13:40 2009
@@ -21,7 +21,6 @@
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/ChainedDiagnosticClient.h"
#include "clang/Frontend/CompilerInvocation.h"
-#include "clang/Frontend/DiagnosticOptions.h"
#include "clang/Frontend/FixItRewriter.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/PCHReader.h"
@@ -259,51 +258,6 @@
llvm::cl::desc("Use specified token cache file"));
//===----------------------------------------------------------------------===//
-// Diagnostic Options
-//===----------------------------------------------------------------------===//
-
-static llvm::cl::opt<bool>
-VerifyDiagnostics("verify",
- llvm::cl::desc("Verify emitted diagnostics and warnings"));
-
-static llvm::cl::opt<bool>
-NoShowColumn("fno-show-column",
- llvm::cl::desc("Do not include column number on diagnostics"));
-
-static llvm::cl::opt<bool>
-NoShowLocation("fno-show-source-location",
- llvm::cl::desc("Do not include source location information with"
- " diagnostics"));
-
-static llvm::cl::opt<bool>
-NoCaretDiagnostics("fno-caret-diagnostics",
- llvm::cl::desc("Do not include source line and caret with"
- " diagnostics"));
-
-static llvm::cl::opt<bool>
-NoDiagnosticsFixIt("fno-diagnostics-fixit-info",
- llvm::cl::desc("Do not include fixit information in"
- " diagnostics"));
-
-static llvm::cl::opt<bool>
-PrintSourceRangeInfo("fdiagnostics-print-source-range-info",
- llvm::cl::desc("Print source range spans in numeric form"));
-
-static llvm::cl::opt<bool>
-PrintDiagnosticOption("fdiagnostics-show-option",
- llvm::cl::desc("Print diagnostic name with mappable diagnostics"));
-
-static llvm::cl::opt<unsigned>
-MessageLength("fmessage-length",
- llvm::cl::desc("Format message diagnostics so that they fit "
- "within N columns or fewer, when possible."),
- llvm::cl::value_desc("N"));
-
-static llvm::cl::opt<bool>
-PrintColorDiagnostic("fcolor-diagnostics",
- llvm::cl::desc("Use colors in diagnostics"));
-
-//===----------------------------------------------------------------------===//
// C++ Visualization.
//===----------------------------------------------------------------------===//
@@ -313,7 +267,7 @@
llvm::cl::desc("View C++ inheritance for a specified class"));
//===----------------------------------------------------------------------===//
-// Builtin Options
+// Frontend Options
//===----------------------------------------------------------------------===//
static llvm::cl::opt<bool>
@@ -321,6 +275,10 @@
llvm::cl::desc("Print the amount of time each "
"phase of compilation takes"));
+static llvm::cl::opt<bool>
+VerifyDiagnostics("verify",
+ llvm::cl::desc("Verify emitted diagnostics and warnings"));
+
//===----------------------------------------------------------------------===//
// Language Options
//===----------------------------------------------------------------------===//
@@ -1235,18 +1193,6 @@
return LK;
}
-static void ConstructDiagnosticOptions(DiagnosticOptions &Opts) {
- // Initialize the diagnostic options.
- Opts.ShowColumn = !NoShowColumn;
- Opts.ShowLocation = !NoShowLocation;
- Opts.ShowCarets = !NoCaretDiagnostics;
- Opts.ShowFixits = !NoDiagnosticsFixIt;
- Opts.ShowSourceRanges = PrintSourceRangeInfo;
- Opts.ShowOptionNames = PrintDiagnosticOption;
- Opts.ShowColors = PrintColorDiagnostic;
- Opts.MessageLength = MessageLength;
-}
-
static void FinalizeCompileOptions(CompileOptions &Opts,
const LangOptions &Lang) {
if (Lang.NoBuiltin)
@@ -1323,7 +1269,7 @@
// Construct the diagnostic options first, which cannot fail, so that we can
// build a diagnostic client to use for any errors during option handling.
DiagnosticOptions DiagOpts;
- ConstructDiagnosticOptions(DiagOpts);
+ InitializeDiagnosticOptions(DiagOpts);
// Create the diagnostic client for reporting errors or for
// implementing -verify.
More information about the cfe-commits
mailing list