Fix unsafe use of StringRef I introduced.

llvm-svn: 86829
This commit is contained in:
Daniel Dunbar 2009-11-11 10:10:25 +00:00
parent 22bdabf05f
commit 559f7a5c3c
1 changed files with 3 additions and 2 deletions

View File

@ -202,8 +202,9 @@ int main(int argc, const char **argv) {
//
// Note that we intentionally want to use argv[0] here, to support "clang++"
// being a symlink.
llvm::StringRef ProgName(llvm::sys::Path(argv[0]).getBasename());
if (ProgName.endswith("++") || ProgName.rsplit('-').first.endswith("++"))
std::string ProgName(llvm::sys::Path(argv[0]).getBasename());
if (llvm::StringRef(ProgName).endswith("++") ||
llvm::StringRef(ProgName).rsplit('-').first.endswith("++"))
TheDriver.CCCIsCXX = true;
llvm::OwningPtr<Compilation> C;