[cfe-commits] r86966 - in /cfe/trunk: include/clang/Frontend/DiagnosticOptions.h tools/clang-cc/Options.cpp tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 11 23:28:22 PST 2009
Author: ddunbar
Date: Thu Nov 12 01:28:21 2009
New Revision: 86966
URL: http://llvm.org/viewvc/llvm-project?rev=86966&view=rev
Log:
Move dump-build-information option into DiagnosticOptions.
Modified:
cfe/trunk/include/clang/Frontend/DiagnosticOptions.h
cfe/trunk/tools/clang-cc/Options.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Frontend/DiagnosticOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/DiagnosticOptions.h?rev=86966&r1=86965&r2=86966&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/DiagnosticOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/DiagnosticOptions.h Thu Nov 12 01:28:21 2009
@@ -31,6 +31,10 @@
/// Column limit for formatting message diagnostics, or 0 if unused.
unsigned MessageLength;
+ /// If non-empty, a file to log extended build information to, for development
+ /// testing and analysis.
+ std::string DumpBuildInformation;
+
public:
DiagnosticOptions() {
ShowColumn = 1;
Modified: cfe/trunk/tools/clang-cc/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Options.cpp?rev=86966&r1=86965&r2=86966&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Options.cpp (original)
+++ cfe/trunk/tools/clang-cc/Options.cpp Thu Nov 12 01:28:21 2009
@@ -221,6 +221,11 @@
namespace diagnosticoptions {
+static llvm::cl::opt<std::string>
+DumpBuildInformation("dump-build-information",
+ llvm::cl::value_desc("filename"),
+ llvm::cl::desc("output a dump of some build information to a file"));
+
static llvm::cl::opt<bool>
NoShowColumn("fno-show-column",
llvm::cl::desc("Do not include column number on diagnostics"));
@@ -659,14 +664,15 @@
void clang::InitializeDiagnosticOptions(DiagnosticOptions &Opts) {
using namespace diagnosticoptions;
- Opts.ShowColumn = !NoShowColumn;
- Opts.ShowLocation = !NoShowLocation;
+ Opts.DumpBuildInformation = DumpBuildInformation;
+ Opts.MessageLength = MessageLength;
Opts.ShowCarets = !NoCaretDiagnostics;
+ Opts.ShowColors = PrintColorDiagnostic;
+ Opts.ShowColumn = !NoShowColumn;
Opts.ShowFixits = !NoDiagnosticsFixIt;
- Opts.ShowSourceRanges = PrintSourceRangeInfo;
+ Opts.ShowLocation = !NoShowLocation;
Opts.ShowOptionNames = PrintDiagnosticOption;
- Opts.ShowColors = PrintColorDiagnostic;
- Opts.MessageLength = MessageLength;
+ Opts.ShowSourceRanges = PrintSourceRangeInfo;
}
void clang::InitializeHeaderSearchOptions(HeaderSearchOptions &Opts,
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=86966&r1=86965&r2=86966&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Thu Nov 12 01:28:21 2009
@@ -341,9 +341,10 @@
llvm::cl::desc("Whether to build a relocatable precompiled "
"header"));
-// Finally, implement the code that groks the options above.
+//===----------------------------------------------------------------------===//
+// Preprocessor construction
+//===----------------------------------------------------------------------===//
-// Add the clang headers, which are relative to the clang binary.
std::string GetBuiltinIncludePath(const char *Argv0) {
llvm::sys::Path P =
llvm::sys::Path::GetMainExecutable(Argv0,
@@ -363,10 +364,6 @@
return P.str();
}
-//===----------------------------------------------------------------------===//
-// Preprocessor construction
-//===----------------------------------------------------------------------===//
-
static Preprocessor *
CreatePreprocessor(Diagnostic &Diags, const LangOptions &LangInfo,
const PreprocessorOptions &PPOpts,
@@ -433,6 +430,7 @@
//===----------------------------------------------------------------------===//
// ObjC Rewriter Options
//===----------------------------------------------------------------------===//
+
static llvm::cl::opt<bool>
SilenceRewriteMacroWarning("Wno-rewrite-macros", llvm::cl::init(false),
llvm::cl::desc("Silence ObjC rewriting warnings"));
@@ -452,23 +450,18 @@
static llvm::cl::opt<bool> OptNoWarnings("w");
//===----------------------------------------------------------------------===//
-// -dump-build-information Stuff
+// Dump Build Information
//===----------------------------------------------------------------------===//
-static llvm::cl::opt<std::string>
-DumpBuildInformation("dump-build-information",
- llvm::cl::value_desc("filename"),
- llvm::cl::desc("output a dump of some build information to a file"));
-
static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
unsigned argc, char **argv,
llvm::OwningPtr<DiagnosticClient> &DiagClient) {
std::string ErrorInfo;
- llvm::raw_ostream *OS = new llvm::raw_fd_ostream(DumpBuildInformation.c_str(),
- ErrorInfo);
+ llvm::raw_ostream *OS =
+ new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo);
if (!ErrorInfo.empty()) {
llvm::errs() << "error opening -dump-build-information file '"
- << DumpBuildInformation << "', option ignored!\n";
+ << DiagOpts.DumpBuildInformation << "', option ignored!\n";
delete OS;
return;
}
@@ -1081,7 +1074,7 @@
DiagClient.reset(new TextDiagnosticPrinter(llvm::errs(), Opts));
}
- if (!DumpBuildInformation.empty())
+ if (!Opts.DumpBuildInformation.empty())
SetUpBuildDumpLog(Opts, argc, argv, DiagClient);
// Configure our handling of diagnostics.
More information about the cfe-commits
mailing list