aaron.ballman added a comment.

Can you also add a release note for the changes?



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7800
+                          attr::Kind, AttrKind) {
+  return llvm::any_of(Node.getAttrs(),
+                      [&](const Attr *A) { return A->getKind() == AttrKind; });
----------------
Well this is awkward. :-D There's no way to check for whether the node has 
attributes for both kinds of nodes, but decl nodes requires that check; but 
there's no range-based for loop (or other iterator interface) that's the same 
on both nodes either.

I think you're going to need to add a class to `ASTMatchersInternal.h` to 
dispatch to the correct implementation for this query. You can look at how 
`HasSizeMatcher` is implemented and used to get an idea.


================
Comment at: clang/lib/AST/DeclBase.cpp:909
 const AttrVec &Decl::getAttrs() const {
-  assert(HasAttrs && "No attrs to get!");
   return getASTContext().getDeclAttrs(this);
----------------
I don't think it's valid to remove this assert (looking at the git blame for 
this and `ASTContext::getDeclAttrs()` shows this has all been the same for the 
past 12 years).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120949/new/

https://reviews.llvm.org/D120949

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to