diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-29 21:28:15 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-29 21:28:15 +0000 |
commit | 6465d4f7a36077df16188d3d9d512f951333851a (patch) | |
tree | 33755550c7ad0f96612c0f29ab5a1f8b2d003031 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 488b6f7bbc1dcbd739c4bd5afbb2f1adc3e2fa1c (diff) | |
download | bcm5719-llvm-6465d4f7a36077df16188d3d9d512f951333851a.tar.gz bcm5719-llvm-6465d4f7a36077df16188d3d9d512f951333851a.zip |
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 1fdfc8de687..5b344284139 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -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. |