[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-12-15 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: @mikaelholmen , thanks for the report. These warnings are kind of expected, there is no big difference between `struct S1 s01 = { 1, {1} };` and `struct S1 s02 = { .d1.a = 1 };` in both cases field `b` of `d1` is not initialized. But they are not expected for C, since we aim t

[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-12-15 Thread via cfe-commits
mikaelholmen wrote: Hi @Fznamznon and others! It looks like this patch not only avoids a false positive, but it also causes warnigns on stuff it didn't warn on before. So if I add the following to clang/test/Sema/missing-field-initializers.c ``` struct S1 { long int l; struct { int a, b; }

[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-12-06 Thread Aaron Ballman via cfe-commits
@@ -802,9 +845,25 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity, } } } else { + InitListExpr *SForm = + ILE->isSyntacticForm() ? ILE : ILE->getSyntacticForm(); // The fields beyond ILE->getNumInits() are d

[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-11-22 Thread Richard Smith via cfe-commits
@@ -727,6 +729,44 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, if (hadError || VerifyOnly) { // Do nothing } else if (Init < NumInits) { zygoloid wrote: Hm, right, we still call this with `Init >= NumInits` w

[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-11-10 Thread via cfe-commits
@@ -654,11 +655,17 @@ void InitListChecker::FillInEmptyInitForBase( } } -void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, -const InitializedEntity &ParentEntity, -

[llvm] [clang] [clang-tools-extra] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-11-06 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/70829 >From ac30780250875802d13450d17e6959f9e2ad3a70 Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Tue, 31 Oct 2023 09:27:51 -0700 Subject: [PATCH 1/2] [clang] Fix false positive -Wmissing-field-initi