[llvm] Fix file index verifier when there is no file name in the prologue. (PR #77004)

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 10:16:38 PST 2024


================
@@ -940,8 +940,13 @@ void DWARFVerifier::verifyDebugLineRows() {
         OS << '\n';
       }
 
-      // Verify file index.
-      if (!LineTable->hasFileAtIndex(Row.File)) {
+      // If the prologue contains no file names and the line table has only one
+      // row, do not verify the file index, this is a line table of an empty
+      // file with an end_sequence, but the DWARF standard sets the file number
+      // to 1 by default, otherwise verify file index.
+      if (!(LineTable->Prologue.FileNames.size() == 0 &&
----------------
rastogishubham wrote:

Nice De-Morgan's law application, I wrote it the way I did because it was more readable to me, but either is fine

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


More information about the llvm-commits mailing list