[PATCH] D133108: [clang] Rework IsTailPaddedMemberArray into isFlexibleArrayMemberExpr
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 15 10:07:41 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:15881
+/// Check whether this array fits the idiom of a flexible array member,
+/// depending on -fstrict-flex-array value
///
----------------
depending on <ins>the value of</ins> -fstrict-flex-array <del>value</del><ins>.</ins>
(Sorry, the Suggest Edits button seems to be unavailable)
================
Comment at: clang/lib/Sema/SemaChecking.cpp:15969
+ if (const MemberExpr *ME = dyn_cast<MemberExpr>(BaseExpr))
+ ND = ME->getMemberDecl();
+
----------------
msebor wrote:
> I'm not familiar with this code but I'm guessing that at most one of the `if` conditionals is true, and if it's the first one then the second `dyn_cast` will fail. Should the `if` guarding this assignment then be an `else if`?
While this code is moving around from elsewhere, +1, this should use an `else if`. Also, you should use `const auto *` for the declarations since the type is explicitly spelled out in the initializers.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:15974
+ bool IsUnboundedArray =
+ (BaseType == nullptr) ||
+ isFlexibleArrayMemberExpr(*this, BaseExpr, ND, StrictFlexArraysLevel);
----------------
You can drop the parens.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133108/new/
https://reviews.llvm.org/D133108
More information about the cfe-commits
mailing list