[cfe-commits] r141525 - /cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Sun Oct 9 18:23:06 PDT 2011
Author: grosser
Date: Sun Oct 9 20:23:06 2011
New Revision: 141525
URL: http://llvm.org/viewvc/llvm-project?rev=141525&view=rev
Log:
Parse LLVM command line arguments after plugins have been loaded
This fixes a crash due to command line options, that are not available
before the loading of plugins finished.
Modified:
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=141525&r1=141524&r2=141525&view=diff
==============================================================================
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Sun Oct 9 20:23:06 2011
@@ -133,9 +133,20 @@
return 0;
}
+ // 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))
+ Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
+ << Path << Error;
+ }
+
// Honor -mllvm.
//
// FIXME: Remove this, one day.
+ // This should happen AFTER plugins have been loaded!
if (!Clang->getFrontendOpts().LLVMArgs.empty()) {
unsigned NumArgs = Clang->getFrontendOpts().LLVMArgs.size();
const char **Args = new const char*[NumArgs + 2];
@@ -146,16 +157,6 @@
llvm::cl::ParseCommandLineOptions(NumArgs + 1, const_cast<char **>(Args));
}
- // 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))
- Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
- << Path << Error;
- }
-
// Honor -analyzer-checker-help.
// This should happen AFTER plugins have been loaded!
if (Clang->getAnalyzerOpts().ShowCheckerHelp) {
More information about the cfe-commits
mailing list