[clang] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 06:38:18 PDT 2024
================
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,
return false;
}
+static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) {
----------------
AaronBallman wrote:
I was going to say we should be handling this at the `AttributeCommonInfo` level... but oh boy.
https://github.com/llvm/llvm-project/blob/a919588df4f108cef5829363a9ec6a1968dbb03a/clang/include/clang/Basic/AttributeCommonInfo.h#L64
That's a layering violation! We should move `AttrParsedAttrList` from Sema to Basic. But we should be able to use `isStandardAttributeSyntax()` in combination with the parsed attribute kind to determine whether the attribute is reserved or not (which would be a new .inc file generated by tablegen) that should amount to a simple switch saying "this attribute kind could be a standard attribute", coupled with a call to check the syntax used.
https://github.com/llvm/llvm-project/pull/106036
More information about the cfe-commits
mailing list