llvm-project
llvm-project copied to clipboard
ParsedAttr plugins with AS_Microsoft spellings are never matched.
this example plugin should match the provided sample code, but doesnt.
struct ExampleAttrInfo : public ParsedAttrInfo {
ExampleAttrInfo() {
static constexpr Spelling S[] = {
{ParsedAttr::AS_Microsoft, "example"}
};
Spellings = S;
}
bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
return true;
}
AttrHandling handleDeclAttribute(Sema &S, Decl *D, const ParsedAttr &Attr) const override {
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "example";
return AttributeApplied;
}
};
static ParsedAttrInfoRegistry::Add<ExampleAttrInfo> Y("example", "");
[example]
class Hello {};
This appears to be because non-standard microsoft attributes are purposefully ignored but attributes registered via plugins are not handled by ParsedAttr::getParsedKind.
@llvm/issue-subscribers-clang-frontend
Author: Elliot (apache-hb)
this example plugin should match the provided sample code, but doesnt.
```cpp
struct ExampleAttrInfo : public ParsedAttrInfo {
ExampleAttrInfo() {
static constexpr Spelling S[] = {
{ParsedAttr::AS_Microsoft, "example"}
};
Spellings = S;
}
bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
return true;
}
AttrHandling handleDeclAttribute(Sema &S, Decl *D, const ParsedAttr &Attr) const override {
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "example";
return AttributeApplied;
}
};
static ParsedAttrInfoRegistry::Add<ExampleAttrInfo> Y("example", "");
```cpp
[example]
class Hello {};
This appears to be because non-standard microsoft attributes are purposefully ignored but attributes registered via plugins are not handled by ParsedAttr::getParsedKind.