[all-commits] [llvm/llvm-project] 34535e: [Sema] Enforce parameter match for ownership_retur...

David Meng via All-commits all-commits at lists.llvm.org
Mon Apr 27 14:17:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 34535e9bae8b798370768775dfed6065aaca806b
      https://github.com/llvm/llvm-project/commit/34535e9bae8b798370768775dfed6065aaca806b
  Author: David Meng <davidmenggx at gmail.com>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/test/Sema/attr-ownership.c

  Log Message:
  -----------
  [Sema] Enforce parameter match for ownership_returns attribute (#192339)

Previously parsing multiple ownership_returns attributes with different
arguments could lead to a crash. The documentation states that if
forward declarations have ownership_returns, they must have the same
arguments, and it may appear at most once per declaration.

This patch ensures that if multiple ownership_returns attributes are
present, their arguments (identifier and the optional index) must
exactly match. The diagonstic err_ownership_param_mismatch is introduced
for clarity.

Test cases for f15, C::f, and the newly added f22 were also updated to
match the requirement that all declarations of ownership_returns have
the same arguments, using the err_ownership_param_mismatch diagonstic.

Fixes #188733



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list