[clang] [Clang] Diagnose conflict between always_inline/noinline attributes (PR #215173)
Kenzo Tjandra via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 13 06:24:14 PDT 2026
================
@@ -779,10 +779,10 @@ void CodeGenFunction::EmitLabelStmt(const LabelStmt &S) {
}
void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) {
- bool nomerge = false;
- bool noinline = false;
- bool alwaysinline = false;
- bool noconvergent = false;
+ bool nomerge = InNoMergeAttributedStmt;
+ bool noinline = InNoInlineAttributedStmt;
+ bool alwaysinline = InAlwaysInlineAttributedStmt;
+ bool noconvergent = InNoConvergentAttributedStmt;
StringRef amdgpuAVMode;
----------------
ketjandr wrote:
Ahh I get what you're saying now... so if we have instead
```
[[musttail]]
return outer_fn(({
inner_fn();
}));
```
`MustTailCall` still remains preserved (pointing to `outer_fn`) as we recurse inside the stmt-expr, as opposed to
```
[[musttail]]
return outer_fn(({
[[always_inline]]
inner_fn();
}));
```
which will clobber `MustTailCall` since `always_inline` saves it as `nullptr`. So the intended behavior should be as if `always_inline` isn't there. Am I understanding this correctly?
And a follow-up would be - do you think this should apply to all the other statement attributes then?
https://github.com/llvm/llvm-project/pull/215173
More information about the cfe-commits
mailing list