aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-11 10:10:25 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-11 10:10:25 +0000
commite26bd90e5f7c1e44dd2b74d84d2f158dc7b983fb (patch)
treec4f5c18d1f86eb16c8e0321fcde6b413b02c42af
parent29cf746aef63b1984c013448e843a290b2badf7b (diff)
Fix unsafe use of StringRef I introduced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86829 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/driver/driver.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 1947bac99b..fb7c6cc7b0 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -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;