[PATCH] D25600: [ASTMatcher] Add isStaticDataMember matcher for varDecl.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 07:29:25 PDT 2016


hokein added inline comments.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:3005
+/// \endcode
+AST_MATCHER(VarDecl, isStaticDataMember) {
+  return Node.isStaticDataMember();
----------------
aaron.ballman wrote:
> How does this differ from the existing matcher `hasStaticStorageDuration()` over a `fieldDecl()`?
`fieldDecl` document says that fieldDecl is "an instance of this class is created by Sema::ActOnField to
represent a member of a struct/union/class.". So for static class members, they should not belong to `fieldDecl` as they are not bound to class instances.
 
Technically, we can't apply `hasStaticStorageDuration()` and `isStaticStorageClass` over a `fieldDecl`.
 


https://reviews.llvm.org/D25600





More information about the cfe-commits mailing list