Fix use-after-destruction introduced in r224924.
getMainExecutable() returns a std::string, assigning its result to StringRef immediately creates a dangling pointer. This was detected by half-broken fast-MSan-bootstrap bot. llvm-svn: 224956
This commit is contained in:
@@ -983,7 +983,8 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||
|
||||
std::string CompilerInvocation::GetResourcesPath(const char *Argv0,
|
||||
void *MainAddr) {
|
||||
StringRef ClangExecutable = llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
|
||||
std::string ClangExecutable =
|
||||
llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
|
||||
StringRef Dir = llvm::sys::path::parent_path(ClangExecutable);
|
||||
|
||||
// Compute the path to the resource directory.
|
||||
|
||||
Reference in New Issue
Block a user