DerivedArgList *TranslateInputArgs(const InputArgList &Args) const;
public:
- Driver(llvm::StringRef _Name, llvm::StringRef _Dir,
+ Driver(llvm::StringRef _ClangExecutable,
llvm::StringRef _DefaultHostTriple,
llvm::StringRef _DefaultImageName,
bool IsProduction, bool CXXIsProduction,
using namespace clang::driver;
using namespace clang;
-Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir,
+Driver::Driver(llvm::StringRef _ClangExecutable,
llvm::StringRef _DefaultHostTriple,
llvm::StringRef _DefaultImageName,
bool IsProduction, bool CXXIsProduction,
Diagnostic &_Diags)
: Opts(createDriverOptTable()), Diags(_Diags),
- Name(_Name), Dir(_Dir), DefaultHostTriple(_DefaultHostTriple),
+ ClangExecutable(_ClangExecutable), DefaultHostTriple(_DefaultHostTriple),
DefaultImageName(_DefaultImageName),
DriverTitle("clang \"gcc-compatible\" driver"),
Host(0),
CCCUseClangCXX = false;
}
+ llvm::sys::Path Executable(ClangExecutable);
+ Name = Executable.getBasename();
+ Dir = Executable.getDirname();
+
// Compute the path to the resource directory.
llvm::sys::Path P(Dir);
P.eraseComponent(); // Remove /bin from foo/bin
P.appendComponent("clang");
P.appendComponent(CLANG_VERSION_STRING);
ResourceDir = P.str();
-
- // Save the original clang executable path.
- P = Dir;
- P.appendComponent(Name);
- ClangExecutable = P.str();
}
Driver::~Driver() {
Args.push_back("-fsyntax-only");
// FIXME: We shouldn't have to pass in the path info.
- driver::Driver TheDriver("clang", "/", llvm::sys::getHostTriple(),
+ driver::Driver TheDriver("clang", llvm::sys::getHostTriple(),
"a.out", false, false, *Diags);
// Don't check that inputs exist, they have been remapped.
const bool IsProduction = false;
const bool CXXIsProduction = false;
#endif
- Driver TheDriver(Path.getBasename(), Path.getDirname(),
- llvm::sys::getHostTriple(),
+ Driver TheDriver(Path.str(), llvm::sys::getHostTriple(),
"a.out", IsProduction, CXXIsProduction,
Diags);