Driver: Handle magic -ccc- options.
- Follows ccc currently, but this functionality should eventually be
outside the Driver lib.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66575 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 31990a8..ad6c807 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -18,13 +18,20 @@
#include "clang/Driver/Options.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/System/Path.h"
#include "llvm/System/Signals.h"
using namespace clang::driver;
int main(int argc, const char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
- llvm::OwningPtr<Driver> TheDriver(new Driver());
+ // FIXME: We should use GetMainExecutable here, probably, but we may
+ // want to handle symbolic links slightly differently. The problem
+ // is that the path derived from this will influence search paths.
+ llvm::sys::Path Path(argv[0]);
+
+ llvm::OwningPtr<Driver> TheDriver(new Driver(Path.getBasename().c_str(),
+ Path.getDirname().c_str()));
llvm::OwningPtr<Compilation> C(TheDriver->BuildCompilation(argc, argv));