[clang] Match against all plugins when parsing microsoft attributes (PR #86426)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 24 06:47:56 PDT 2024
================
@@ -5061,11 +5061,15 @@ 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())) {
----------------
Sirraide wrote:
Hmm, I can’t find a place where we’re doing anything like this here for the other syntaxes, so I’m not sure this is the right approach. `hasAttribute()` from `clang/Basic/Attributes.h` seems to do what you’re trying to do here; have you tried using that one?
https://github.com/llvm/llvm-project/pull/86426
More information about the cfe-commits
mailing list