[DebugInfo] Store optional DIFile::Source as pointer

getCanonicalMDString() also returns a nullptr for empty strings, which
tripped over the getSource() method. Solve the ambiguity of no source
versus an optional containing a nullptr by simply storing a pointer.

Differential Revision: https://reviews.llvm.org/D138658
This commit is contained in:
Jonas Hahnfeld
2022-12-01 14:14:43 +01:00
parent 61318fa5c7
commit c9cb4fc761
8 changed files with 60 additions and 31 deletions

View File

@@ -1808,7 +1808,7 @@ void ModuleBitcodeWriter::writeDIFile(const DIFile *N,
}
auto Source = N->getRawSource();
if (Source)
Record.push_back(VE.getMetadataOrNullID(*Source));
Record.push_back(VE.getMetadataOrNullID(Source));
Stream.EmitRecord(bitc::METADATA_FILE, Record, Abbrev);
Record.clear();