https://github.com/apache-hb updated https://github.com/llvm/llvm-project/pull/86426
>From 245a21512d8658225b17b91b8af4764f54084e01 Mon Sep 17 00:00:00 2001 From: Elliot <35050275+apache...@users.noreply.github.com> Date: Sun, 24 Mar 2024 03:03:47 -0400 Subject: [PATCH 1/2] Match against all plugins when parsing microsoft attributes fixes #86422 --- clang/lib/Parse/ParseDeclCXX.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 63fe678cbb29e2..d05b3a455f7f63 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -5061,11 +5061,12 @@ void Parser::ParseMicrosoftAttributes(ParsedAttributes &Attrs) { IdentifierInfo *II = Tok.getIdentifierInfo(); SourceLocation NameLoc = Tok.getLocation(); ConsumeToken(); - ParsedAttr::Kind AttrKind = - ParsedAttr::getParsedKind(II, nullptr, ParsedAttr::AS_Microsoft); + // For HLSL we want to handle all attributes, but for MSVC compat, we // silently ignore unknown Microsoft attributes. - if (getLangOpts().HLSL || AttrKind != ParsedAttr::UnknownAttribute) { + AttributeCommonInfo Info{II, NameLoc, AttributeCommonInfo::Form::Microsoft()}; + const ParsedAttrInfo& AttrInfo = ParsedAttrInfo::get(Info); + if (getLangOpts().HLSL || AttrInfo.hasSpelling(AttributeCommonInfo::AS_Microsoft, II->getName())) { bool AttrParsed = false; if (Tok.is(tok::l_paren)) { CachedTokens OpenMPTokens; >From 4e47899a9fb17dec5931007b5025f6ce97dbe3eb Mon Sep 17 00:00:00 2001 From: Elliot <35050275+apache...@users.noreply.github.com> Date: Sun, 24 Mar 2024 03:05:54 -0400 Subject: [PATCH 2/2] Apply formatting --- clang/lib/Parse/ParseDeclCXX.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index d05b3a455f7f63..856ac11f7bb839 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -5064,9 +5064,12 @@ void Parser::ParseMicrosoftAttributes(ParsedAttributes &Attrs) { // For HLSL we want to handle all attributes, but for MSVC compat, we // silently ignore unknown Microsoft attributes. - AttributeCommonInfo Info{II, NameLoc, AttributeCommonInfo::Form::Microsoft()}; - const ParsedAttrInfo& AttrInfo = ParsedAttrInfo::get(Info); - if (getLangOpts().HLSL || AttrInfo.hasSpelling(AttributeCommonInfo::AS_Microsoft, II->getName())) { + AttributeCommonInfo Info{II, NameLoc, + AttributeCommonInfo::Form::Microsoft()}; + const ParsedAttrInfo &AttrInfo = ParsedAttrInfo::get(Info); + if (getLangOpts().HLSL || + AttrInfo.hasSpelling(AttributeCommonInfo::AS_Microsoft, + II->getName())) { bool AttrParsed = false; if (Tok.is(tok::l_paren)) { CachedTokens OpenMPTokens; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits