[PATCH] D106030: [Clang] add support for error+warning fn attrs

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 14 19:05:47 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp:208
     }
+    // TODO: is this the best pass for this?
+    for (BasicBlock &BB : F) {
----------------
Why not just do in in codegen in IRTranslator/SelectionDAGBuilder?


================
Comment at: llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp:212
+        if (CallBase *CB = dyn_cast<CallBase>(&I)) {
+          if (Function *Callee = CB->getCalledFunction()) {
+            if (Callee->hasFnAttribute("user-diagnostic")) {
----------------
What's the expected behavior if the function is called indirectly?


================
Comment at: llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp:219
+              DiagnosticInfoUser DU(
+                  Callee->getFnAttribute("user-diagnostic").getValueAsString(),
+                  Callee->getName(), LocCookie);
----------------
Just do one getFnAttribute instead of pre-checking it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106030



More information about the cfe-commits mailing list