[PATCH] D35012: [refactor] Add the AST source selection component

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 07:08:08 PDT 2017


klimek added inline comments.


================
Comment at: lib/Tooling/Refactoring/ASTSelection.cpp:164
+  unsigned NumMatches = 0;
+  for (Decl *D : Context.getTranslationUnitDecl()->decls()) {
+    if (ObjCImplEndLoc.isValid() &&
----------------
arphaman wrote:
> klimek wrote:
> > arphaman wrote:
> > > klimek wrote:
> > > > Why don't we do this as part of TraverseDecl() in the visitor?
> > > I think it's easier to handle the Objective-C `@implementation` logic here, unless there's some better way that I can't see ATM.
> > Ok, in that case, can you write a comment at the start of the loop explaining that we basically only do that for the Objective-C @implementation? (I'd also like to understand that better in general, as I have no clue about Obj-C :)
> Hmm, maybe it would be better to move this logic to another layer. Like a wrapper around `RecursiveASTVisitor` that ensures that iteration occurs in a lexical order. It can then be used by other things that might need this, this code will get simpler and I will be able to test it better.
Great idea! That would be useful in a bunch of use cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D35012





More information about the cfe-commits mailing list