[llvm] Allow for mixing source/no-source DIFiles in one CU (PR #73877)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 08:51:32 PST 2023


================
@@ -170,9 +170,14 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS,
       if (ContentTypes.HasLength)
         OS << format("         length: 0x%8.8" PRIx64 "\n", FileEntry.Length);
       if (ContentTypes.HasSource) {
-        OS <<        "         source: ";
-        FileEntry.Source.dump(OS, DumpOptions);
-        OS << '\n';
+        auto Source = FileEntry.Source.getAsCString();
+        if (!Source)
+          consumeError(Source.takeError());
+        else if (*Source && (*Source)[0]) {
----------------
felipepiovezan wrote:

IIUC we are doing `*Source` just for safety, as this should never happen, and we test `(*Source)[0]` to check for the following part of the spec?

>  The value is an empty null-terminated string if no source is available.



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


More information about the llvm-commits mailing list