[PATCH] D141451: [clang] report inlining decisions with -Wattribute-{warning|error}

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 07:17:37 PDT 2023


erichkeane added a comment.

Just comments from the CFE.



================
Comment at: clang/include/clang/Basic/DiagnosticFrontendKinds.td:94
+def note_fe_backend_in : Note<"In function '%0'">;
+def note_fe_backend_inlined : Note<"\twhich inlined function '%0'">;
 
----------------
This tab in the diagnostic is odd, we never do this, we just count on the cascading notes to be clear.  Also, this probably needs bikeshedding for diagnostic messages.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:860
+
+  Diags.Report(diag::note_fe_backend_in) << llvm::demangle(D.getCaller().str());
+
----------------
Could we instead just make `demangle` take a `string_view` here?  It takes it by const-ref, which shows that it doesn't really seem to need it to be a string, so I would imagine this would be a minor refactor (to add such an overload).


================
Comment at: clang/test/Frontend/backend-attribute-error-warning-optimize.c:29
+               // expected-note@* {{In function 'd'}}
+               // expected-note@* {{which inlined function 'b'}}
+               // expected-note@* {{which inlined function 'a'}}
----------------
Same comment re-bookmarks, but this diagnostic seems awkward.  

Should we instead say :

`call to 'foo' declared with 'error' attribute: oh no foo`
`called by function 'a'`
`inlined by function 'b'`
`inlined by function 'd'`?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141451



More information about the cfe-commits mailing list