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

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 10 16:32:51 PST 2023


================
@@ -654,11 +655,17 @@ void InitListChecker::FillInEmptyInitForBase(
   }
 }
 
-void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
-                                        const InitializedEntity &ParentEntity,
-                                              InitListExpr *ILE,
-                                              bool &RequiresSecondPass,
-                                              bool FillWithNoInit) {
+static bool hasAnyDesignatedInits(const InitListExpr *IL) {
+  for (const Stmt *Init : *IL)
+    if (isa_and_nonnull<DesignatedInitExpr>(Init))
+      return true;
+  return false;
----------------
cor3ntin wrote:

Can you use llvm::any_of ?

https://github.com/llvm/llvm-project/pull/70829


More information about the cfe-commits mailing list