diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-08-12 02:53:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-08-12 02:53:07 +0000 |
commit | a6bf47f855fa205015e8904c3b80fafbf7bd896d (patch) | |
tree | 9ef1656ca57322a65620ba3ef59686a26c35707e /tools/driver/cc1_main.cpp | |
parent | 507384f0074498b658cc1455dbb912dd95455512 (diff) | |
download | clang-a6bf47f855fa205015e8904c3b80fafbf7bd896d.tar.gz |
clang -cc1: Move real diagnostics client initialization to earlier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r-- | tools/driver/cc1_main.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 0699b7f48d..dcf7d4e5c1 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -222,6 +222,18 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, Clang->getHeaderSearchOpts().ResourceDir = CompilerInvocation::GetResourcesPath(Argv0, MainAddr); + // Create the actual diagnostics engine. + Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin)); + if (!Clang->hasDiagnostics()) + return 1; + + // Set an error handler, so that any LLVM backend diagnostics go through our + // error handler. + llvm::install_fatal_error_handler(LLVMErrorHandler, + static_cast<void*>(&Clang->getDiagnostics())); + + DiagsBuffer.FlushDiagnostics(Clang->getDiagnostics()); + // Honor -help. if (Clang->getFrontendOpts().ShowHelp) { llvm::OwningPtr<driver::OptTable> Opts(driver::createCC1OptTable()); @@ -251,25 +263,14 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, llvm::cl::ParseCommandLineOptions(NumArgs + 1, const_cast<char **>(Args)); } - // Create the actual diagnostics engine. - Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin)); - if (!Clang->hasDiagnostics()) - return 1; - - // Set an error handler, so that any LLVM backend diagnostics go through our - // error handler. - llvm::install_fatal_error_handler(LLVMErrorHandler, - static_cast<void*>(&Clang->getDiagnostics())); - - DiagsBuffer.FlushDiagnostics(Clang->getDiagnostics()); - // Load any requested plugins. for (unsigned i = 0, e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) { const std::string &Path = Clang->getFrontendOpts().Plugins[i]; std::string Error; if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error)) - Diags.Report(diag::err_fe_unable_to_load_plugin) << Path << Error; + Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin) + << Path << Error; } // If there were errors in processing arguments, don't do anything else. |