aaron.ballman added inline comments.
================ Comment at: clang/examples/Attribute/Attribute.cpp:25 +struct ExampleAttrInfo : public ParsedAttrInfo { + ExampleAttrInfo() { + // Set the kind to NoSemaHandlerAttribute to make sure clang doesn't assume ---------------- It would be really handy for the example to show how to list subjects for the declaration attribute, as that's a very common need. ================ Comment at: clang/examples/Attribute/Attribute.cpp:29 + AttrKind = ParsedAttr::NoSemaHandlerAttribute; + // Can take an optional string argument. + OptArgs = 1; ---------------- Nothing here suggests the argument must be a string. It would be ideal to show users how to list out arguments and their types. ================ Comment at: clang/examples/Attribute/Attribute.cpp:32-33 + // GNU-style __attribute__(("example")) and C++-style [[example]] supported. + Spellings.push_back({ParsedAttr::AS_GNU, "example"}); + Spellings.push_back({ParsedAttr::AS_CXX11, "::example"}); + } ---------------- Showing how to have a vendor namespace would also be especially helpful. As a point of design, I wonder if we should be documenting (or diagnosing?) attributes from plugins that are added to the clang vendor namespace, as that does not seem like something we want to encourage? ================ Comment at: clang/examples/Attribute/Attribute.cpp:35 + } + virtual bool handleDeclAttribute(Sema &S, Decl *D, + const ParsedAttr &Attr) const { ---------------- It is unclear to me how a user would add an attribute that needs to follow the merge pattern we use in `mergeDeclAttribute()`. ================ Comment at: clang/examples/Attribute/Attribute.cpp:53 + } else { + S.Diag(ArgExpr->getExprLoc(), diag::err_attribute_argument_type) + << Attr.getAttrName() << AANT_ArgumentString; ---------------- Do we have a way for plugin authors to introduce their own diagnostics, or are they limited to just what diagnostics we already provide? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D31343/new/ https://reviews.llvm.org/D31343 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits