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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 02:29:51 PDT 2022


hokein accepted this revision.
hokein added a comment.

it looks good to me, just a few optional nits.



================
Comment at: clang/include/clang/AST/DeclCXX.h:3618
+  /// The source location of the 'enum' keyword.
+  SourceLocation EnumLoc;
+  /// 'qual::SomeEnum' as an EnumType, possibly with Elaborated/Typedef sugar.
----------------
nit: we only rename  `EnumLocation` but not the `UsingLocation`, it is a little wired, I think either we rename both or keep both unchanged.



================
Comment at: clang/include/clang/AST/DeclCXX.h:3623
   /// The enum
   EnumDecl *Enum;
 
----------------
I think we can probably get rid of the `Enum` field, since we are storing the EnumType and we can get the EnumDecl by `dyn_cast<EnumDecl>(EnumType->getType()->getAsTagDecl())`


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11857
   assert(!SS->isInvalid() && "ScopeSpec is invalid");
-  ParsedType TypeRep = getTypeName(II, IdentLoc, S, SS);
-  if (!TypeRep) {
+  TypeSourceInfo *TSI;
+  QualType EnumTy = GetTypeFromParser(
----------------
nit: adding `= nullptr` initializer


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