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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224956
91177308-0d34-0410-b5e6-
96231b3b80d8
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.