diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-04 00:39:48 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-04 00:39:48 +0000 |
commit | 016f6f6a58aa31418de5592085c2e0ae06d4050d (patch) | |
tree | 8ab4b8c66d42fd9de7d6830ddabc0e0f63433498 | |
parent | 57b6536ba1ba66aca802e4fa1f78ab5fdc2df34b (diff) | |
download | bcm5719-llvm-016f6f6a58aa31418de5592085c2e0ae06d4050d.tar.gz bcm5719-llvm-016f6f6a58aa31418de5592085c2e0ae06d4050d.zip |
[dsymutil] Fix stack-use-after-scope
The lambda is taking the stack-allocated Verify boolean by reference and
it would go out of scope on the next iteration. Moving it out of the
loop should fix the issue.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43549
llvm-svn: 373683
-rw-r--r-- | llvm/tools/dsymutil/dsymutil.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index fe69abed0a8..983e86808e7 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -520,9 +520,10 @@ int main(int argc, char **argv) { // If there is more than one link to execute, we need to generate // temporary files. - bool NeedsTempFiles = + const bool NeedsTempFiles = !Options.DumpDebugMap && (Options.OutputFile != "-") && (DebugMapPtrsOrErr->size() != 1 || Options.LinkOpts.Update); + const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput; SmallVector<MachOUtils::ArchAndFile, 4> TempFiles; std::atomic_char AllOK(1); @@ -577,7 +578,6 @@ int main(int argc, char **argv) { } } - const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput; auto LinkLambda = [&, OutputFile](std::shared_ptr<raw_fd_ostream> Stream, LinkOptions Options) { AllOK.fetch_and( |