Avoid self-assignment of SmallString, trigger UB behavior down the road.

llvm-svn: 257947
This commit is contained in:
Joerg Sonnenberger 2016-01-15 22:29:34 +00:00
parent fa0b4b271a
commit 9db01aaf78
1 changed files with 3 additions and 3 deletions

View File

@ -290,9 +290,9 @@ static void SetInstallDir(SmallVectorImpl<const char *> &argv,
if (CanonicalPrefixes) if (CanonicalPrefixes)
llvm::sys::fs::make_absolute(InstalledPath); llvm::sys::fs::make_absolute(InstalledPath);
InstalledPath = llvm::sys::path::parent_path(InstalledPath); StringRef InstalledPathParent(llvm::sys::path::parent_path(InstalledPath));
if (llvm::sys::fs::exists(InstalledPath.c_str())) if (llvm::sys::fs::exists(InstalledPathParent))
TheDriver.setInstalledDir(InstalledPath); TheDriver.setInstalledDir(InstalledPathParent);
} }
static int ExecuteCC1Tool(ArrayRef<const char *> argv, StringRef Tool) { static int ExecuteCC1Tool(ArrayRef<const char *> argv, StringRef Tool) {