[libcxx-commits] [PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

Matheus Izvekov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 16 15:40:14 PDT 2022


mizvekov added a comment.

In D112374#3657472 <https://reviews.llvm.org/D112374#3657472>, @kimgr wrote:

> I can't say what the best solution is, but this patch generates quite a lot of work for me, and I would really hope that catching up with the new AST does not generate even more work down the line.

Okay, I checked out IWYU and I see why you need to look at ElaboratedType in some cases. And that also answers a lot of my previous questions.

Some type nodes were before rarely ever elaborated, but will have an ElaboratedType over them consistently now.
Searching IWYU source code, some cases where dyn_cast is used in some of them:

iwyu.cc:

      // If we're a constructor, we also need to construct the entire class,
      // even typedefs that aren't used at construct time. Try compiling
      //    template<class T> struct C { typedef typename T::a t; };
      //    class S; int main() { C<S> c; }
      if (isa<CXXConstructorDecl>(fn_decl)) {
        CHECK_(parent_type && "How can a constructor have no parent?");
        parent_type = RemoveElaboration(parent_type);
        if (!TraverseDataAndTypeMembersOfClassHelper(
                dyn_cast<TemplateSpecializationType>(parent_type)))
          return false;
      }
      return true;
  `

  if (const auto* enum_type = dyn_cast<EnumType>(type))
    return !CanBeOpaqueDeclared(enum_type);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112374



More information about the libcxx-commits mailing list