[cfe-commits] r108667 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp lib/Frontend/ASTUnit.cpp tools/driver/driver.cpp
Daniel Dunbar
daniel at zuster.org
Sun Jul 18 17:44:04 PDT 2010
Author: ddunbar
Date: Sun Jul 18 19:44:04 2010
New Revision: 108667
URL: http://llvm.org/viewvc/llvm-project?rev=108667&view=rev
Log:
Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
- Fixes a problem where the Clang executable path was not initialized properly
on Win32, because sys::Path::getBasename() doesn't do what I always think it
does. Imagine that, a sys::Path interface that is confusing!
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/tools/driver/driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=108667&r1=108666&r2=108667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Sun Jul 18 19:44:04 2010
@@ -145,7 +145,7 @@
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,
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=108667&r1=108666&r2=108667&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Jul 18 19:44:04 2010
@@ -39,13 +39,13 @@
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),
@@ -68,6 +68,10 @@
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
@@ -75,11 +79,6 @@
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() {
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=108667&r1=108666&r2=108667&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Sun Jul 18 19:44:04 2010
@@ -413,7 +413,7 @@
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.
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=108667&r1=108666&r2=108667&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Sun Jul 18 19:44:04 2010
@@ -219,8 +219,7 @@
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);
More information about the cfe-commits
mailing list