[PATCH] D123826: Fix size of flexible array initializers, and re-enable assertions.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 15 06:02:41 PDT 2022


erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

Couple nits, otherwise LGTM.



================
Comment at: clang/lib/AST/Decl.cpp:2731
+    return false;
+  auto *List = dyn_cast<InitListExpr>(getInit()->IgnoreParens());
+  if (!List)
----------------



================
Comment at: clang/lib/AST/Decl.cpp:2732
+  auto *List = dyn_cast<InitListExpr>(getInit()->IgnoreParens());
+  if (!List)
+    return false;
----------------



================
Comment at: clang/lib/AST/Decl.cpp:2735
+  const Expr *FlexibleInit = List->getInit(List->getNumInits() - 1);
+  auto InitTy = Ctx.getAsConstantArrayType(FlexibleInit->getType());
+  if (!InitTy)
----------------
Same here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123826



More information about the cfe-commits mailing list