[clang] Match against all plugins when parsing microsoft attributes (PR #86426)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 24 00:05:40 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Elliot (apache-hb)

<details>
<summary>Changes</summary>

Fixes #<!-- -->86422

---
Full diff: https://github.com/llvm/llvm-project/pull/86426.diff


1 Files Affected:

- (modified) clang/lib/Parse/ParseDeclCXX.cpp (+4-3) 


``````````diff
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;

``````````

</details>


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


More information about the cfe-commits mailing list