[PATCH] D111706: [lld-macho] Use StringRef's hash code as keys of loadedArchives

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 17:54:34 PDT 2021


oontvoo added inline comments.


================
Comment at: lld/MachO/Driver.cpp:355-357
   if (Optional<std::string> path = findFramework(name)) {
     if (auto *dylibFile = dyn_cast_or_null<DylibFile>(
             addFile(*path, /*forceLoadArchive=*/false, isExplicit))) {
----------------
I think this is where the dangling reference is .

Could you add `saver.save(*path)` here? 
(ie.,`addFile(saver.save(*path),/*forceLoadArchive=*/false, isExplicit))` )

Storing the strings themselves are probably better than hash_code.




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

https://reviews.llvm.org/D111706



More information about the llvm-commits mailing list