Page MenuHomePhabricator

[AST] Add accessSpecs() iterator range for CXXRecordDecl
AbandonedPublic

Authored by m4tx on Dec 17 2018, 2:33 PM.

Details

Summary

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

Diff Detail

Event Timeline

m4tx created this revision.Dec 17 2018, 2:33 PM
riccibruno added a subscriber: riccibruno.EditedDec 17 2018, 2:49 PM

Do you really have to add an iterator for this particular thing ?
Why not just use specific_decl_iterator<AccessSpecDecl> in your clang-tidy checker ?

m4tx added a comment.EditedDec 17 2018, 3:05 PM

Do you really have to add an iterator for this particular thing ?
Why not just use specific_decl_iterator<AccessSpecDecl> in your clang-tidy checker ?

I don't need to - if this is the preferred way to accomplish this, I'm more than happy to modify the revisions. I just saw other range methods that are only used once (e.g. CXXRecordDecl::friends()).

m4tx abandoned this revision.Dec 17 2018, 3:39 PM

Do you really have to add an iterator for this particular thing ?
Why not just use specific_decl_iterator<AccessSpecDecl> in your clang-tidy checker ?

I don't need to - if this is the preferred way to accomplish this, I'm more than happy to modify the revisions. I just saw other range methods that are only used once (e.g. CXXRecordDecl::friends()).

I think this has utility because it exposes a range accessor, but it's up to you which way you'd like to go. I left some comments in case you decide to pick this patch back up again.

include/clang/AST/DeclCXX.h
855

I'd prefer access_spec to accessspec (here and elsewhere).