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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to