aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDoug Gregor <dgregor@apple.com>2024-10-02 10:21:23 -0700
committerGitHub <noreply@github.com>2024-10-02 18:21:23 +0100
commit694fd1f297feaf59cd29a3d17e63ee2f6514dd16 (patch)
treef08cca9f2306a369651ad9469dc69ee8c28435ad /clang/lib/Sema/SemaDecl.cpp
parentf2eeb3dc7b438e4216ac6b970129b607d6de31f9 (diff)
downloadllvm-694fd1f297feaf59cd29a3d17e63ee2f6514dd16.zip
llvm-694fd1f297feaf59cd29a3d17e63ee2f6514dd16.tar.gz
llvm-694fd1f297feaf59cd29a3d17e63ee2f6514dd16.tar.bz2
Allow tag-based API notes on anonymous tag decls with typedef names
It is common practice in C to declare anonymous tags that are immediately given a typedef name, e.g., typedef enum { ... } MyType; At present, one can only express API notes on the typedef. However, that excludes the possibility of tag-specific notes like EnumExtensibility. For these anonymous declarations, process API notes using the typedef name as the tag name, so that one can add API notes to `MyType` via the `Tags` section.
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e4c45cb..add28b3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4974,6 +4974,9 @@ void Sema::setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
// Otherwise, set this as the anon-decl typedef for the tag.
TagFromDeclSpec->setTypedefNameForAnonDecl(NewTD);
+
+ // Now that we have a name for the tag, process API notes again.
+ ProcessAPINotes(TagFromDeclSpec);
}
static unsigned GetDiagnosticTypeSpecifierID(const DeclSpec &DS) {