r224956 - Fix use-after-destruction introduced in r224924.
Alexey Samsonov
vonosmas at gmail.com
Mon Dec 29 13:28:15 PST 2014
Author: samsonov
Date: Mon Dec 29 15:28:15 2014
New Revision: 224956
URL: http://llvm.org/viewvc/llvm-project?rev=224956&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=224956&r1=224955&r2=224956&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Dec 29 15:28:15 2014
@@ -983,7 +983,8 @@ static InputKind ParseFrontendArgs(Front
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.
More information about the cfe-commits
mailing list