[PATCH] D134791: [clang] Unify Sema and CodeGen implementation of isFlexibleArrayMemberExpr

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 07:42:32 PDT 2022


aaron.ballman added a comment.

In general, this looks reasonable to me.



================
Comment at: clang/include/clang/AST/Expr.h:529
+  /// When IgnoreTemplateOrMacroSubstitution is set, it doesn't consider sizes
+  /// resulting from substitution of macro or template as special sizes.
+  bool isFlexibleArrayMemberLike(
----------------



================
Comment at: clang/include/clang/AST/Expr.h:531
+  bool isFlexibleArrayMemberLike(
+      ASTContext &Context, unsigned StrictFlexArraysLevel,
+      bool IgnoreTemplateOrMacroSubstitution = false) const;
----------------
Do we want to make the array levels into an enumeration instead of letting the user pass arbitrary integers? (Perhaps not as part of this review.)


================
Comment at: clang/lib/AST/Expr.cpp:244-247
+  if (const auto *FD = dyn_cast<FieldDecl>(ND)) {
+
+    if (FD->getParent()->isUnion())
+      return true;
----------------



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

https://reviews.llvm.org/D134791



More information about the cfe-commits mailing list