[PATCH] D134303: [AST] Preserve more structure in UsingEnumDecl node.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 06:49:15 PDT 2022


sammccall added a comment.

In D134303#3805687 <https://reviews.llvm.org/D134303#3805687>, @urnathan wrote:

> AFAICT the UsingDecl doesn't capture the NestedNameSpecifier location

We have `NestedNameSpecifierLoc UsingDecl::QualifierLoc` already, maybe I'm misunderstanding.

> is UsingEnumDecl special in some way, or would this information be better placed in BaseUsingDecl?

It would be possible to unify the two by moving UsingDecl's QualifierLoc into BaseUsingDecl..

I think this comes at the cost of a worse API for UsingEnumDecl: making the qualifier as part of a Typeloc/TypeSourceInfo means that AST consumers with some generic handling for TypeLocs can reuse it. (e.g. the clangd changes in this patch are mostly just testing various things that now work for free).

UsingDecl already has that comparatively awkward API today - it's one of the AST nodes that very often needs to be handled explicitly - unavoidably as "reference to a decl" is not modeled in the AST, and because it may point to an overload set etc anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134303



More information about the cfe-commits mailing list