[clang] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 11:06:48 PDT 2024
================
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,
return false;
}
+static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) {
----------------
erichkeane wrote:
I concur with Aaron. The point of this restriction is to permit the library to use attributes without the risk of someone macroing them away.
I ALSO think that macroing away non-standards attributes should be perfectly fine, so we should only have this diagnostic for standards attributes. I THINK we have some infrastructure already to detect those (`__has_cpp_attribute` I think also returns non-zero for non standards attributes? But perhaps we can re-use the fact that the standards ones use a date?)?
https://github.com/llvm/llvm-project/pull/106036
More information about the cfe-commits
mailing list