[PATCH] D55790: [AST] Add accessSpecs() iterator range for CXXRecordDecl

Mateusz Maćkowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 17 14:33:23 PST 2018


m4tx created this revision.
Herald added a subscriber: cfe-commits.

Adds an iterator that allows to loop over C++ class/union/struct access specifier declarations.


Repository:
  rC Clang

https://reviews.llvm.org/D55790

Files:
  include/clang/AST/DeclCXX.h


Index: include/clang/AST/DeclCXX.h
===================================================================
--- include/clang/AST/DeclCXX.h
+++ include/clang/AST/DeclCXX.h
@@ -851,6 +851,22 @@
     return vbases_begin() + data().NumVBases;
   }
 
+  /// Iterator access to member access specifiers.
+  using accessspec_iterator = specific_decl_iterator<AccessSpecDecl>;
+  using accessspec_range =
+      llvm::iterator_range<specific_decl_iterator<AccessSpecDecl>>;
+
+  accessspec_range accessSpecs() const {
+    return accessspec_range(accessspec_begin(), accessspec_end());
+  }
+  accessspec_iterator accessspec_begin() const {
+    return accessspec_iterator(decl_iterator(FirstDecl));
+  }
+
+  accessspec_iterator accessspec_end() const {
+    return accessspec_iterator(decl_iterator());
+  }
+
   /// Determine whether this class has any dependent base classes which
   /// are not the current instantiation.
   bool hasAnyDependentBases() const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55790.178532.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181217/77167f76/attachment.bin>


More information about the cfe-commits mailing list