[PATCH] D113082: [lld-macho] Implement -arch_errors_fatal

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 12:06:02 PDT 2021


keith added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:793
+    if (config->errorForArchMismatch)
+      error(toString(this) + " has architecture " + getArchitectureName(arch) +
+            " which is incompatible with target architecture " +
----------------
int3 wrote:
> could we factor out the arguments somehow? E.g. something like `auto f = config->errorForArchMismatch ? error : warning`? (not sure if that compiles though)
I couldn't get a version of assigning the functions to a variable to work due to `reference to overloaded function could not be resolved`, I might have been doing something wrong?

Either way for now I added a simple lambda to de-duplicate the string, lmk what you think.

Note the whole reason I didn't assign the string to a variable instead was it seems like Twine is prime to use-after-free issues so the string was garbled in the output, clang-tidy also warned about that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113082



More information about the llvm-commits mailing list