aboutsummaryrefslogtreecommitdiff
path: root/tools/clang-cc/clang-cc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/clang-cc/clang-cc.cpp')
-rw-r--r--tools/clang-cc/clang-cc.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 2899684284..b189b4b51d 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -42,6 +42,7 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/System/DynamicLibrary.h"
#include "llvm/System/Host.h"
#include "llvm/System/Path.h"
#include "llvm/System/Signals.h"
@@ -299,7 +300,8 @@ int main(int argc, char **argv) {
Clang.getDiagnostics(), argv[0]))
return 1;
#else
- // Buffer diagnostics from argument parsing.
+ // Buffer diagnostics from argument parsing so that we can output them using a
+ // well formed diagnostic object.
TextDiagnosticBuffer DiagsBuffer;
Diagnostic Diags(&DiagsBuffer);
@@ -321,6 +323,15 @@ int main(int argc, char **argv) {
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;
+ }
+
// If there were any errors in processing arguments, exit now.
if (Clang.getDiagnostics().getNumErrors())
return 1;