[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 30 09:04:22 PDT 2024
================
@@ -177,6 +180,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,
+ PP.getTargetInfo(), Lang) > 0) {
+ AttributeCommonInfo::Kind AttrKind = AttributeCommonInfo::getParsedKind(
+ II, /*Scope*/ nullptr, AttributeCommonInfo::Syntax::AS_CXX11);
+ return !((AttrKind == AttributeCommonInfo::Kind::AT_Likely ||
----------------
erichkeane wrote:
I'm kinda confused how this works, can you explain it here? Why the likely/unlikely exception here?
https://github.com/llvm/llvm-project/pull/106036
More information about the cfe-commits
mailing list