[PATCH] D158006: [Clang][WIP]Experimental implementation of data member packs in dependent context.

Zenong Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 13:39:28 PDT 2023


SlaterLatiao marked 6 inline comments as done.
SlaterLatiao added inline comments.


================
Comment at: clang/lib/Sema/SemaExprMember.cpp:523-524
+      auto *TD = TST->getTemplateName().getAsTemplateDecl();
+      assert(isa<ClassTemplateDecl>(TD) &&
+             "template decl in member access is not ClassTemplateDecl");
+      for (FieldDecl *Field :
----------------
dblaikie wrote:
> No need for the assert if you're immediately going to `cast` anyway, it'll assert. Though perhaps the custom assert here gives you a chance to make it more explicit that this is intentional.
Removed the assert.


================
Comment at: clang/lib/Sema/SemaExprMember.cpp:525-527
+      for (FieldDecl *Field :
+           cast<ClassTemplateDecl>(TD)->getTemplatedDecl()->fields()) {
+        if (Field->getDeclName() == NameInfo.getName()) {
----------------
dblaikie wrote:
> This could be `llvm::find_if`, maybe? Not sure if it'd be tidier, but maybe more legible
Rewrote with `llvm::find_if`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158006



More information about the cfe-commits mailing list