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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 18:56:38 PDT 2023


MaskRay added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:863
+  InliningDecisions.push_back(D.getCaller().str());
+  for (size_t i = 0, e = InliningDecisions.size(); i != e; ++i) {
+    std::string S = llvm::demangle(InliningDecisions[i]);
----------------
aaron.ballman wrote:
> Alternatively:
> ```
> for (auto Dec : llvm::enumerate(InliningDecisions)) {
>   std::string S = llvm::demangle(Dec.value());
>   if (Dec.index() == 0)
>     Diags.Report(...);
>   ...
> }
> ```
Nit: use C++17 structured bindings


================
Comment at: clang/test/Frontend/backend-attribute-error-warning-optimize.c:34
+static inline void b() {
+    a(10);
+}
----------------
The new lines mix 2-space and 4-space indentations. 2 spaces should be more common.


================
Comment at: llvm/test/Transforms/Inline/dontcall-attributes.ll:28
+define void @baz() {
+; CHECK-LABEL: @baz(
+; CHECK-NEXT:    call void @foo(), !inlined.from !0
----------------
`; CHECK-LABEL: define {{[^@]+}}@baz(` (feel free to use another form, but keep `define`)

Otherwise `@baz` is not unique and may match a `call void @baz(...)`.


================
Comment at: llvm/test/Transforms/Inline/dontcall-attributes.ll:30
+; CHECK-NEXT:    call void @foo(), !inlined.from !0
+;
+  call void @bar(i32 10)
----------------
Unneeded `^;$` line.


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