[PATCH] D128184: [lld-macho] Show source information for undefined references

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 14:42:23 PDT 2022


thakis added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:1379
+std::string ObjFile::sourceFile() const {
+  if (!compileUnit)
+    return {};
----------------
BertalanD wrote:
> thakis wrote:
> > Do we need this check? All current callers of sourceFile() check compileUnit before calling this.
> This sounds like one of those narrow vs wide contract API questions. Should I remove the check from here, replace it with an assert, or remove the check from `getSourceLocation`? I don't really have a preference.
I'd just remove the check. Adding an assert is fine, but it's kind of implied be the (then) unguarded deref


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

https://reviews.llvm.org/D128184



More information about the llvm-commits mailing list