[PATCH] D149675: [LLD] fix llvm::demangle lifetime issue

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 12:46:40 PDT 2023


MaskRay added a comment.

In D149675#4313265 <https://reviews.llvm.org/D149675#4313265>, @efriedma wrote:

> This doesn't make any sense.  If the argument "name" is live on entry to the function, it'll remain alive until the function exit.  Converting it to a string_view should maintain the same lifetime.  Converting it to an std::string actually makes the lifetime shorter.

I agree with the analysis. It's more likely a caller of `maybeDemangleSymbol` passes a temporary whose lifetime has ended.

Switching to `string_view` may expose (due to expensive checks setting `_GLIBCXX_DEBUG`) latent bugs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149675/new/

https://reviews.llvm.org/D149675



More information about the llvm-commits mailing list