[clang] [Sema] Enforce parameter match for ownership_returns attribute (PR #192339)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 24 13:46:38 PDT 2026
================
@@ -1558,21 +1572,23 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// Cannot have two ownership attributes of different kinds for the same
// index.
if (I->getOwnKind() != K && llvm::is_contained(I->args(), Idx)) {
- S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible)
- << AL << I
- << (AL.isRegularKeywordAttribute() ||
- I->isRegularKeywordAttribute());
- return;
+ S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible)
+ << AL << I
+ << (AL.isRegularKeywordAttribute() ||
+ I->isRegularKeywordAttribute());
+ return;
} else if (K == OwnershipAttr::Returns &&
----------------
steakhal wrote:
I think we should honour the [else-after-return](https://clang.llvm.org/extra/clang-tidy/checks/readability/else-after-return.html) rule.
https://github.com/llvm/llvm-project/pull/192339
More information about the cfe-commits
mailing list