[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

Erich Keane via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 06:46:46 PST 2025


================
@@ -173,6 +176,20 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,
   return false;
 }
 
+static bool isReservedCXXAttributeName(Preprocessor &PP, IdentifierInfo *II) {
+  const LangOptions &Lang = PP.getLangOpts();
+  if (Lang.CPlusPlus &&
+      hasAttribute(AttributeCommonInfo::Syntax::AS_CXX11, /*Scope*/ nullptr, II,
----------------
erichkeane wrote:

`hasAttribute` and `getParsedKind` have a lot of overlap in the work they do, and I THINK should work right here?  Could you just check the AttrKind against 'invalid' instead of doing the `hasAttribute` check first?

https://github.com/llvm/llvm-project/pull/106036


More information about the llvm-commits mailing list