diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp index 4d4654ead748b4661e4294ae10be2ebf71408570..3d0d6409d90ec34da94b1d4f692ad95276a1610b 100644 --- a/examples/clang-interpreter/main.cpp +++ b/examples/clang-interpreter/main.cpp @@ -128,7 +128,7 @@ int main(int argc, const char **argv, char * const *envp) { Clang.setInvocation(CI.take()); // Create the compilers actual diagnostics engine. - Clang.createDiagnostics(int(CCArgs.size()),const_cast<char**>(CCArgs.data())); + Clang.createDiagnostics(); if (!Clang.hasDiagnostics()) return 1; diff --git a/include/clang/Basic/DiagnosticOptions.h b/include/clang/Basic/DiagnosticOptions.h index 2b80e9b9eadcdb14e91d2dc11f63d2ef44e769d3..1a68d9576589dace4f52b4b185443aa81b73523e 100644 --- a/include/clang/Basic/DiagnosticOptions.h +++ b/include/clang/Basic/DiagnosticOptions.h @@ -49,10 +49,6 @@ protected: #include "clang/Basic/DiagnosticOptions.def" public: - /// If non-empty, a file to log extended build information to, for development - /// testing and analysis. - std::string DumpBuildInformation; - /// The file to log diagnostic output to. std::string DiagnosticLogFile; diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index af06f2ee91557e8fef75cfe6ad88c8b1138b0093..d48530335012ef36c30969efa7d169bb23c8abf7 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -215,9 +215,6 @@ def header_include_file : Separate<["-"], "header-include-file">, // Diagnostic Options //===----------------------------------------------------------------------===// -def dump_build_information : Separate<["-"], "dump-build-information">, - MetaVarName<"<filename>">, - HelpText<"output a dump of some build information to a file">; def diagnostic_log_file : Separate<["-"], "diagnostic-log-file">, HelpText<"Filename (or -) to log diagnostics to">; def diagnostic_serialized_file : Separate<["-"], "serialize-diagnostic-file">, diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 2d6a8702dc646436dc5eac6689a91d71680c80b1..492a3c57cd59f5f538cb1105343c23d126c84d8b 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -479,17 +479,12 @@ public: /// /// \param ShouldCloneClient If Client is non-NULL, specifies whether that /// client should be cloned. - void createDiagnostics(int Argc, const char* const *Argv, - DiagnosticConsumer *Client = 0, + void createDiagnostics(DiagnosticConsumer *Client = 0, bool ShouldOwnClient = true, bool ShouldCloneClient = true); /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter. /// - /// The \p Argc and \p Argv arguments are used only for logging purposes, - /// when the diagnostic options indicate that the compiler should output - /// logging information. - /// /// If no diagnostic client is provided, this creates a /// DiagnosticConsumer that is owned by the returned diagnostic /// object, if using directly the caller is responsible for @@ -507,8 +502,7 @@ public: /// /// \return The new object on success, or null on failure. static IntrusiveRefCntPtr<DiagnosticsEngine> - createDiagnostics(DiagnosticOptions *Opts, int Argc, - const char* const *Argv, + createDiagnostics(DiagnosticOptions *Opts, DiagnosticConsumer *Client = 0, bool ShouldOwnClient = true, bool ShouldCloneClient = true, diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h index 6d92442457cdc3d7dca03482a5744e509eb01599..27e5a0af25730d4a99422b2945788275b499de7b 100644 --- a/include/clang/Tooling/Tooling.h +++ b/include/clang/Tooling/Tooling.h @@ -151,8 +151,7 @@ class ToolInvocation { bool runInvocation(const char *BinaryName, clang::driver::Compilation *Compilation, - clang::CompilerInvocation *Invocation, - const clang::driver::ArgStringList &CC1Args); + clang::CompilerInvocation *Invocation); std::vector<std::string> CommandLine; OwningPtr<FrontendAction> ToolAction; diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index a958fd93d6c5a778a97fa72dc41184118fb97b0a..9ab3a8faba4e14b61b4632e7e0672cb0c6bf328f 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -656,8 +656,7 @@ void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags, if (CaptureDiagnostics) Client = new StoredDiagnosticConsumer(AST.StoredDiagnostics); Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(), - ArgEnd-ArgBegin, - ArgBegin, Client, + Client, /*ShouldOwnClient=*/true, /*ShouldCloneClient=*/false); } else if (CaptureDiagnostics) { @@ -1946,9 +1945,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. - Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(), - ArgEnd - ArgBegin, - ArgBegin); + Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); } SmallVector<StoredDiagnostic, 4> StoredDiagnostics; diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 8ceb9f72fdd4864bbb26f4e78cd6c6b014d6eb92..9941eae8d4c9b0605a154f57cf35d583efa9042c 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -92,29 +92,6 @@ void CompilerInstance::setCodeCompletionConsumer(CodeCompleteConsumer *Value) { } // Diagnostics -static void SetUpBuildDumpLog(DiagnosticOptions *DiagOpts, - unsigned argc, const char* const *argv, - DiagnosticsEngine &Diags) { - std::string ErrorInfo; - OwningPtr<raw_ostream> OS( - new llvm::raw_fd_ostream(DiagOpts->DumpBuildInformation.c_str(),ErrorInfo)); - if (!ErrorInfo.empty()) { - Diags.Report(diag::err_fe_unable_to_open_logfile) - << DiagOpts->DumpBuildInformation << ErrorInfo; - return; - } - - (*OS) << "clang -cc1 command line arguments: "; - for (unsigned i = 0; i != argc; ++i) - (*OS) << argv[i] << ' '; - (*OS) << '\n'; - - // Chain in a diagnostic client which will log the diagnostics. - DiagnosticConsumer *Logger = - new TextDiagnosticPrinter(*OS.take(), DiagOpts, /*OwnsOutputStream=*/true); - Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(), Logger)); -} - static void SetUpDiagnosticLog(DiagnosticOptions *DiagOpts, const CodeGenOptions *CodeGenOpts, DiagnosticsEngine &Diags) { @@ -167,18 +144,16 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts, SerializedConsumer)); } -void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv, - DiagnosticConsumer *Client, +void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client, bool ShouldOwnClient, bool ShouldCloneClient) { - Diagnostics = createDiagnostics(&getDiagnosticOpts(), Argc, Argv, Client, + Diagnostics = createDiagnostics(&getDiagnosticOpts(), Client, ShouldOwnClient, ShouldCloneClient, &getCodeGenOpts()); } IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(DiagnosticOptions *Opts, - int Argc, const char* const *Argv, DiagnosticConsumer *Client, bool ShouldOwnClient, bool ShouldCloneClient, @@ -205,9 +180,6 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts, if (!Opts->DiagnosticLogFile.empty()) SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags); - if (!Opts->DumpBuildInformation.empty()) - SetUpBuildDumpLog(Opts, Argc, Argv, *Diags); - if (!Opts->DiagnosticSerializationFile.empty()) SetupSerializedDiagnostics(Opts, *Diags, Opts->DiagnosticSerializationFile); @@ -854,8 +826,7 @@ static void compileModule(CompilerInstance &ImportingInstance, // module. CompilerInstance Instance; Instance.setInvocation(&*Invocation); - Instance.createDiagnostics(/*argc=*/0, /*argv=*/0, - &ImportingInstance.getDiagnosticClient(), + Instance.createDiagnostics(&ImportingInstance.getDiagnosticClient(), /*ShouldOwnClient=*/true, /*ShouldCloneClient=*/true); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 2c02c423c18434f9e77a408e914edc3b69822c05..9329b3bc1b09d820a9b8c4c88fe0c1d74500c714 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -577,7 +577,6 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, << Opts.TabStop << DiagnosticOptions::DefaultTabStop; } Opts.MessageLength = Args.getLastArgIntValue(OPT_fmessage_length, 0, Diags); - Opts.DumpBuildInformation = Args.getLastArgValue(OPT_dump_build_information); addWarningArgs(Args, Opts.Warnings); return Success; diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index 1ce23f737e38022f642fee644ebc552c78233d19..e25eb4322c55d7ca135e0869f8eefa8dc74d2bb9 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -34,9 +34,7 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList, if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. - Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions, - ArgList.size(), - ArgList.begin()); + Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions); } SmallVector<const char *, 16> Args; diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index ac378a99847209c55ff6b50477c1c06240aec179..a9e7b84808c18fdef411d29667fb55e8053d2b65 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -179,15 +179,13 @@ bool ToolInvocation::run() { } OwningPtr<clang::CompilerInvocation> Invocation( newInvocation(&Diagnostics, *CC1Args)); - return runInvocation(BinaryName, Compilation.get(), Invocation.take(), - *CC1Args); + return runInvocation(BinaryName, Compilation.get(), Invocation.take()); } bool ToolInvocation::runInvocation( const char *BinaryName, clang::driver::Compilation *Compilation, - clang::CompilerInvocation *Invocation, - const clang::driver::ArgStringList &CC1Args) { + clang::CompilerInvocation *Invocation) { // Show the invocation, with -v. if (Invocation->getHeaderSearchOpts().Verbose) { llvm::errs() << "clang Invocation:\n"; @@ -207,8 +205,7 @@ bool ToolInvocation::runInvocation( OwningPtr<FrontendAction> ScopedToolAction(ToolAction.take()); // Create the compilers actual diagnostics engine. - Compiler.createDiagnostics(CC1Args.size(), - const_cast<char**>(CC1Args.data())); + Compiler.createDiagnostics(); if (!Compiler.hasDiagnostics()) return false; diff --git a/tools/diagtool/ShowEnabledWarnings.cpp b/tools/diagtool/ShowEnabledWarnings.cpp index abd69fd0af618a0786d9a93f0b55e623eb765b70..bcc7520c1bd7b5a5623c3015f745b660ffbf87b1 100644 --- a/tools/diagtool/ShowEnabledWarnings.cpp +++ b/tools/diagtool/ShowEnabledWarnings.cpp @@ -71,8 +71,7 @@ createDiagnostics(unsigned int argc, char **argv) { // Build the diagnostics parser IntrusiveRefCntPtr<DiagnosticsEngine> FinalDiags = - CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(), - argc, argv); + CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts()); if (!FinalDiags) return NULL; diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 6e1920022f37ec8ead3dd3aaa6494af2b6b1979c..f54c87898c4e47b32a5cfaf8ea04ae48e2421584 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -81,7 +81,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, CompilerInvocation::GetResourcesPath(Argv0, MainAddr); // Create the actual diagnostics engine. - Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin)); + Clang->createDiagnostics(); if (!Clang->hasDiagnostics()) return 1; diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 7d999b86fbb5677b25a3405fbe3502b7049ebe66..f8c6f690962585d541c5b95d677d7c4445e33537 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2587,9 +2587,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { // Configure the diagnostics. IntrusiveRefCntPtr<DiagnosticsEngine> - Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions, - num_command_line_args, - command_line_args)); + Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions)); // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine, diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index 3bbd74a9b2ec9feb31f7695a58f26f846bd616c0..b286650231640f4f044431d781a6472802ca7096 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -543,8 +543,6 @@ static void clang_indexSourceFile_Impl(void *UserData) { // Configure the diagnostics. IntrusiveRefCntPtr<DiagnosticsEngine> Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions, - num_command_line_args, - command_line_args, CaptureDiag, /*ShouldOwnClient=*/true, /*ShouldCloneClient=*/false)); diff --git a/unittests/Frontend/FrontendActionTest.cpp b/unittests/Frontend/FrontendActionTest.cpp index e70c3b85e03e262d4cada01652145fa50f13cf30..bcb340d668877639fada95436c29bb982f38bc57 100644 --- a/unittests/Frontend/FrontendActionTest.cpp +++ b/unittests/Frontend/FrontendActionTest.cpp @@ -60,7 +60,7 @@ TEST(ASTFrontendAction, Sanity) { invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; compiler.setInvocation(invocation); - compiler.createDiagnostics(0, NULL); + compiler.createDiagnostics(); TestASTFrontendAction test_action; ASSERT_TRUE(compiler.ExecuteAction(test_action));