[PATCH] D94382: [clangd] Avoid recursion in TargetFinder::add()

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 10 22:54:41 PST 2021


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:379
     if (const TypedefNameDecl *TND = dyn_cast<TypedefNameDecl>(D)) {
       add(TND->getUnderlyingType(), Flags | Rel::Underlying);
       Flags |= Rel::Alias; // continue with the alias.
----------------
rather than introducing a new member for `CurrentlyProcessing`, can't we just get away with checking the decl we are going to jump on here (and probably in namespace alias case) are the same (or maybe a parameter to add function indicating the parent/previous)?

it is definitely cleaner to have a member rather than checking individually but we have other types of ast nodes we can be currently processing (statements, nested namespecifiers etc. and they are not covered by this member. so it is a little bit confusing conceptually.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94382/new/

https://reviews.llvm.org/D94382



More information about the cfe-commits mailing list