[PATCH] D135107: [clang][NFC] Use enum for -fstrict-flex-arrays

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 03:31:01 PDT 2022


steakhal added a comment.

The StaticAnalyzer changes seem to be correct.



================
Comment at: clang/include/clang/Basic/LangOptions.h:369-376
+    /// Any trailing array memeber is a FAM.
+    Default = 0,
+    /// Any trailing array member of undefined, 0, or 1 size is a FAM.
+    OneZeroOrIncomplete = 1,
+    /// Any trailing array member of undefined or 0 is a FAM.
+    ZeroOrIncomplete = 2,
+    /// Any trailing array member of undefined or 0 is a FAM.
----------------
serge-sans-paille wrote:
> typo: member
For most cases, I can either see no initializers or only the first entry is being initialized.
I believe, by default, the entries would be initialized to `0`, `1`, and `2` here anyway.


================
Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:799
+        const FAMKind StrictFlexArraysLevel =
+          getContext().getLangOpts().getStrictFlexArraysLevel();
+        if (StrictFlexArraysLevel == FAMKind::ZeroOrIncomplete ||
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135107



More information about the cfe-commits mailing list