[all-commits] [llvm/llvm-project] 308912: Redesign handling of anyAppleOS availability attri...
Akira Hatanaka via All-commits
all-commits at lists.llvm.org
Wed Apr 15 19:07:21 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3089120f0cd2fe78911d1bc9703764a07fa7eb32
https://github.com/llvm/llvm-project/commit/3089120f0cd2fe78911d1bc9703764a07fa7eb32
Author: Akira Hatanaka <ahatanak at gmail.com>
Date: 2026-04-15 (Wed, 15 Apr 2026)
Changed paths:
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Basic/AttrDocs.td
M clang/include/clang/Sema/Sema.h
M clang/lib/AST/AttrImpl.cpp
M clang/lib/AST/DeclBase.cpp
M clang/lib/Index/CommentToXML.cpp
M clang/lib/Sema/SemaAPINotes.cpp
M clang/lib/Sema/SemaAvailability.cpp
M clang/lib/Sema/SemaDecl.cpp
M clang/lib/Sema/SemaDeclAttr.cpp
M clang/lib/Sema/SemaHLSL.cpp
A clang/test/Index/annotate-comments-availability-anyappleos.cpp
M clang/test/Sema/attr-availability-anyappleos-ast.c
M clang/test/Sema/attr-availability-anyappleos.c
M clang/tools/libclang/CIndex.cpp
M clang/utils/TableGen/ClangAttrEmitter.cpp
Log Message:
-----------
Redesign handling of anyAppleOS availability attribute (#190817)
Previously, when processing an anyAppleOS availability attribute, clang
replaced it with an implicit platform-specific attribute (e.g., ios,
macos) inferred for the current target. Only the introduced version of
the original anyAppleOS attribute was preserved (as a field on the
inferred attr). This was insufficient for clients such as Swift that
need access to the full original attribute, including deprecated,
obsoleted, and message fields.
This patch preserves the original anyAppleOS attribute on the decl and
attaches the inferred platform-specific attribute to it as a child via
the new InferredAttr field. Most callers use getEffectiveAttr() to
transparently get the inferred attr when present, preserving existing
behavior. Fix-it hints use the presence of an inferred attr to decide
whether to emit "anyAppleOS" or a platform-specific name in the
@available expression. The one behavioral change is in documentation
XML, where availability info is now emitted for both the anyAppleOS attr
and the inferred platform-specific attr.
When an explicit platform-specific attribute (e.g. ios(introduced=26.0))
conflicts with an anyAppleOS-derived attribute for the same platform,
the explicit attribute wins: the anyAppleOS attribute is erased from the
decl so only the explicit one is used.
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