[llvm] [NFC] DWARFVerifier: use C-style array instead of brace-enclosed init list (PR #167328)

Andrei Golubev via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 07:39:29 PST 2025


https://github.com/andrey-golubev created https://github.com/llvm/llvm-project/pull/167328

Historically, MSVC would issue a warning seeing a brace-enclosed initializer list variable being used as a range. A quick fix is to use a C-style array instead which is more or less an equivalent form.

Unfortunately, a lot of time has passed since this patch was originally added to our downstream. Thus, the original warning is long lost. The patch is trivial and harmless enough to be applied nonetheless.

>From f935ff6caaa1bb4cd41674cbe388e311b83606be Mon Sep 17 00:00:00 2001
From: "Golubev, Andrey" <andrey.golubev at intel.com>
Date: Mon, 10 Nov 2025 15:29:45 +0000
Subject: [PATCH] [NFC] DWARFVerifier: use C-style array instead of
 brace-enclosed init list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Historically, MSVC would issue a warning seeing a brace-enclosed
initializer list variable being used as a range. A quick fix is to use a
C-style array instead which is more or less an equivalent form.

Unfortunately, a lot of time has passed since this patch was originally
added to our downstream. Thus, the original warning is long lost.
The patch is trivial and harmless enough to be applied nonetheless.

Co-authored-by: Jörn Schöndube <jorn.schondube at intel.com>
---
 llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 693454e249945..440ad4f1268c7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -1523,8 +1523,8 @@ void DWARFVerifier::verifyNameIndexAttribute(
   }
 
   if (AttrEnc.Index == dwarf::DW_IDX_parent) {
-    constexpr static auto AllowedForms = {dwarf::Form::DW_FORM_flag_present,
-                                          dwarf::Form::DW_FORM_ref4};
+    constexpr static dwarf::Form AllowedForms[] = {
+        dwarf::Form::DW_FORM_flag_present, dwarf::Form::DW_FORM_ref4};
     if (!is_contained(AllowedForms, AttrEnc.Form)) {
       ErrorCategory.Report("Unexpected NameIndex Abbreviation", [&]() {
         error() << formatv(



More information about the llvm-commits mailing list