@@ -393,7 +393,7 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
393
393
}
394
394
395
395
static void emitOneV5FileEntry (MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
396
- bool EmitMD5, bool HasSource ,
396
+ bool EmitMD5, bool HasAnySource ,
397
397
std::optional<MCDwarfLineStr> &LineStr) {
398
398
assert (!DwarfFile.Name .empty ());
399
399
if (LineStr)
@@ -408,7 +408,7 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
408
408
MCOS->emitBinaryData (
409
409
StringRef (reinterpret_cast <const char *>(Cksum.data ()), Cksum.size ()));
410
410
}
411
- if (HasSource ) {
411
+ if (HasAnySource ) {
412
412
if (LineStr)
413
413
LineStr->emitRef (MCOS, DwarfFile.Source .value_or (StringRef ()));
414
414
else {
@@ -459,7 +459,7 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
459
459
uint64_t Entries = 2 ;
460
460
if (HasAllMD5)
461
461
Entries += 1 ;
462
- if (HasSource )
462
+ if (HasAnySource )
463
463
Entries += 1 ;
464
464
MCOS->emitInt8 (Entries);
465
465
MCOS->emitULEB128IntValue (dwarf::DW_LNCT_path);
@@ -471,7 +471,7 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
471
471
MCOS->emitULEB128IntValue (dwarf::DW_LNCT_MD5);
472
472
MCOS->emitULEB128IntValue (dwarf::DW_FORM_data16);
473
473
}
474
- if (HasSource ) {
474
+ if (HasAnySource ) {
475
475
MCOS->emitULEB128IntValue (dwarf::DW_LNCT_LLVM_source);
476
476
MCOS->emitULEB128IntValue (LineStr ? dwarf::DW_FORM_line_strp
477
477
: dwarf::DW_FORM_string);
@@ -486,9 +486,9 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
486
486
assert ((!RootFile.Name .empty () || MCDwarfFiles.size () >= 1 ) &&
487
487
" No root file and no .file directives" );
488
488
emitOneV5FileEntry (MCOS, RootFile.Name .empty () ? MCDwarfFiles[1 ] : RootFile,
489
- HasAllMD5, HasSource , LineStr);
489
+ HasAllMD5, HasAnySource , LineStr);
490
490
for (unsigned i = 1 ; i < MCDwarfFiles.size (); ++i)
491
- emitOneV5FileEntry (MCOS, MCDwarfFiles[i], HasAllMD5, HasSource , LineStr);
491
+ emitOneV5FileEntry (MCOS, MCDwarfFiles[i], HasAllMD5, HasAnySource , LineStr);
492
492
}
493
493
494
494
std::pair<MCSymbol *, MCSymbol *>
@@ -605,7 +605,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, StringRef &FileName,
605
605
// If any files have embedded source, they all must.
606
606
if (MCDwarfFiles.empty ()) {
607
607
trackMD5Usage (Checksum.has_value ());
608
- HasSource = ( Source != std::nullopt );
608
+ HasAnySource |= Source. has_value ( );
609
609
}
610
610
if (DwarfVersion >= 5 && isRootFile (RootFile, Directory, FileName, Checksum))
611
611
return 0 ;
@@ -632,11 +632,6 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, StringRef &FileName,
632
632
return make_error<StringError>(" file number already allocated" ,
633
633
inconvertibleErrorCode ());
634
634
635
- // If any files have embedded source, they all must.
636
- if (HasSource != (Source != std::nullopt))
637
- return make_error<StringError>(" inconsistent use of embedded source" ,
638
- inconvertibleErrorCode ());
639
-
640
635
if (Directory.empty ()) {
641
636
// Separate the directory part from the basename of the FileName.
642
637
StringRef tFileName = sys::path::filename (FileName);
@@ -669,8 +664,8 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, StringRef &FileName,
669
664
File.Checksum = Checksum;
670
665
trackMD5Usage (Checksum.has_value ());
671
666
File.Source = Source;
672
- if (Source)
673
- HasSource = true ;
667
+ if (Source. has_value () )
668
+ HasAnySource = true ;
674
669
675
670
// return the allocated FileNumber.
676
671
return FileNumber;
0 commit comments