[clang] Match against all plugins when parsing microsoft attributes (PR #86426)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 24 00:04:57 PDT 2024
https://github.com/apache-hb created https://github.com/llvm/llvm-project/pull/86426
Fixes #86422
>From 245a21512d8658225b17b91b8af4764f54084e01 Mon Sep 17 00:00:00 2001
From: Elliot <35050275+apache-hb at users.noreply.github.com>
Date: Sun, 24 Mar 2024 03:03:47 -0400
Subject: [PATCH] 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;
More information about the cfe-commits
mailing list