[all-commits] [llvm/llvm-project] c44ac9: [clang][APINotes] Do not drop attributes applied a...
Gábor Horváth via All-commits
all-commits at lists.llvm.org
Fri Sep 11 07:33:17 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c44ac9eedba61129a76ff5964db9a0d6bf639b64
https://github.com/llvm/llvm-project/commit/c44ac9eedba61129a76ff5964db9a0d6bf639b64
Author: Gábor Horváth <xazax.hun at gmail.com>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M clang/lib/Sema/SemaDecl.cpp
A clang/test/APINotes/Inputs/Headers/RedeclAnnotation.apinotes
A clang/test/APINotes/Inputs/Headers/RedeclAnnotation.h
A clang/test/APINotes/Inputs/Headers/RedeclDefinition.h
M clang/test/APINotes/Inputs/Headers/module.modulemap
A clang/test/APINotes/redecl-after-definition.c
Log Message:
-----------
[clang][APINotes] Do not drop attributes applied after a definition (#222902)
API notes are matched against whichever declaration the compiler
reaches, which can be a redeclaration that follows the definition. When
the definition lives in one module and the annotated redeclaration in
another, that is exactly what happens: checkNewAttributesAfterDef()
warns "attribute declaration must precede definition" and erases the
attribute, so the annotation is silently lost.
The warning exists to tell users that an attribute they wrote has no
effect. Attributes from API notes are not written in the source, so the
warning has nowhere to point and there is nothing for the user to
correct. Skip attributes with an invalid location, alongside the
existing exceptions.
rdar://186930250
Co-authored-by: Gabor Horvath <gaborh at apple.com>
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