[PATCH] D152083: [clang] Warning for uninitialized elements in fixed-size arrays

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 08:57:27 PDT 2023


erichkeane added a comment.

Needs release notes and tests.  Patch needs full-context added.



================
Comment at: clang/include/clang/Basic/DiagnosticGroups.td:732
 def UninitializedConstReference : DiagGroup<"uninitialized-const-reference">;
+def UninitializedArrayElements : DiagGroup<"uninitialized-array-elements">;
 def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
----------------
philnik wrote:
> Why do you make this a new warning group instead of just adding it to `-Wuninitialized`?
I think the new group makes sense, but it should be a part of Uninitialized as well (see 733).


================
Comment at: clang/lib/Sema/SemaInit.cpp:991
+        Expr **inits = FullyStructuredList->getInits();
+        for (unsigned i = 0, e = FullyStructuredList->getNumInits(); i != e;
+             ++i) {
----------------
should probably just do range-for here, use the .inits here instead.  Perhaps even better is a llvm::find of nullptr.


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

https://reviews.llvm.org/D152083



More information about the cfe-commits mailing list