From a61bb64dcfdf95c2c8634889f1366bcbb4d591f2 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. llvm-svn: 242326 --- clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp index 7fced1e..b534385 100644 --- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ b/clang/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.7.4