[PATCH] D149675: [LLD] fix llvm::demangle lifetime issue
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 11:54:01 PDT 2023
nickdesaulniers created this revision.
Herald added subscribers: pmatos, asb, sunfish, sbc100.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.
D149104 <https://reviews.llvm.org/D149104> converted llvm::demangle to use std::string_view. Enabling
"expensive checks" (via -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON) causes
lld/test/wasm/why-extract.s to fail. It looks like some of the
StringRef's passed to maybeDemangleSymbol are temporaries. Extend their
lifetimes by explicitly copying them to std::string's first before
demangling them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149675
Files:
lld/wasm/Symbols.cpp
Index: lld/wasm/Symbols.cpp
===================================================================
--- lld/wasm/Symbols.cpp
+++ lld/wasm/Symbols.cpp
@@ -35,7 +35,7 @@
if (name == "__main_argc_argv")
return "main";
if (wasm::config->demangle)
- return demangle(name);
+ return demangle(std::string(name));
return name.str();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149675.518818.patch
Type: text/x-patch
Size: 346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/eadf6bd5/attachment.bin>
More information about the llvm-commits
mailing list