[PATCH] D92437: [mac/lld] Include archive name in diagnostics

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 19:51:39 PST 2020


thakis added inline comments.


================
Comment at: lld/MachO/InputFiles.h:74
+  // We use this string for creating error messages.
+  std::string archiveName;
+
----------------
int3 wrote:
> why `std::string` over `StringRef`?
Because it's a potential foot gun: addFile() sets this to `path`, which is a StringRef param and there's no guarantee that that stays alive. In fact, OPT_l calls findLibrary() which seems to return a temp string and pass that in. Since there are relatively few InputFiles, might as well not have a footgun here.


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

https://reviews.llvm.org/D92437



More information about the llvm-commits mailing list