aboutsummaryrefslogtreecommitdiff
path: root/tools/driver/cc1_main.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-15 06:09:03 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-15 06:09:03 +0000
commit3f87fb08dd502309960646db01099fb4c1be9a7c (patch)
tree14d44885588a615f89642234b96b8c9d2e9204f5 /tools/driver/cc1_main.cpp
parent2df2569679237b4979654a8663cd61aea67ab207 (diff)
Driver/Frontend: Add support for -mllvm, which forwards options to the LLVM option parser.
- Note that this is a behavior change, previously -mllvm at the driver level forwarded to clang -cc1. The driver does a little magic to make sure that '-mllvm -disable-llvm-optzns' works correctly, but other users will need to be updated to use -Xclang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r--tools/driver/cc1_main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index e9663f4bbc..41f2997e20 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -241,6 +241,19 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
return 0;
}
+ // Honor -mllvm.
+ //
+ // FIXME: Remove this, one day.
+ if (!Clang->getFrontendOpts().LLVMArgs.empty()) {
+ unsigned NumArgs = Clang->getFrontendOpts().LLVMArgs.size();
+ const char **Args = new const char*[NumArgs + 2];
+ Args[0] = "clang (LLVM option parsing)";
+ for (unsigned i = 0; i != NumArgs; ++i)
+ Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str();
+ Args[NumArgs + 1] = 0;
+ llvm::cl::ParseCommandLineOptions(NumArgs + 1, (char**) Args);
+ }
+
// Create the actual diagnostics engine.
Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin));
if (!Clang->hasDiagnostics())