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

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 08:16:50 PDT 2024


================
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,
   return false;
 }
 
+static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) {
----------------
a-tarasyuk wrote:

@Sirraide @AaronBallman In the context of avoiding hardcoded names., I noticed there's an existing emitter that allows getting `AttrKind` using a string name. Is it okay to use this in this case, or would it be better to add a new emitter that will emit attributes with the new _flag-controlling_ names from the C++ standard?

https://github.com/llvm/llvm-project/blob/9edd998e10fabfff067b9e6e5b044f85a24d0dd5/clang/utils/TableGen/ClangAttrEmitter.cpp#L4875

currenly, it's related to `Sema`, but it might need to be moved to `Basic`...

https://github.com/llvm/llvm-project/blob/9edd998e10fabfff067b9e6e5b044f85a24d0dd5/clang/include/clang/Sema/CMakeLists.txt#L11-L14

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


More information about the cfe-commits mailing list