[clang] Match against all plugins when parsing microsoft attributes (PR #86426)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 25 06:51:28 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())) {
----------------
AaronBallman wrote:
Yeah, something seems off here. If the plugin registers the attribute properly, I think the attribute kind won't be `UnknownAttribute` (IIRC it defaults to `NoSemaHandlerAttribute` unless you specify your own kind) so I would have expected to enter this block anyway.
https://github.com/llvm/llvm-project/pull/86426
More information about the cfe-commits
mailing list