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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 15:40:16 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 &&
----------------
adrian-prantl wrote:

```suggestion
      if ((LineTable->Prologue.FileNames.size() || LineTable->Rows.size() != 1) && !LineTable->hasFileAtIndex(Row.File)) {
```

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


More information about the llvm-commits mailing list