From 3f5ccbd882f53c41debc79813b984345578b9ebc Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Wed, 15 Jul 2015 20:32:07 +0000 Subject: [PATCH] [Static Analyzer] Do not fail silently, when the analyzer is invoked from tooling lib, an analyzer plugin is loaded, but the runtime linker fails to link. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242326 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp index 7fced1e5c7..b534385358 100644 --- a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp @@ -52,7 +52,12 @@ ClangCheckerRegistry::ClangCheckerRegistry(ArrayRef plugins, for (ArrayRef::iterator i = plugins.begin(), e = plugins.end(); i != e; ++i) { // Get access to the plugin. - DynamicLibrary lib = DynamicLibrary::getPermanentLibrary(i->c_str()); + std::string err; + DynamicLibrary lib = DynamicLibrary::getPermanentLibrary(i->c_str(), &err); + if (!lib.isValid()) { + diags->Report(diag::err_fe_unable_to_load_plugin) << *i << err; + continue; + } // See if it's compatible with this build of clang. const char *pluginAPIVersion = -- 2.50.1