@@ -82,7 +82,6 @@ struct llvm::gsym::CUInfo {
8282 }
8383};
8484
85-
8685static DWARFDie GetParentDeclContextDIE (DWARFDie &Die) {
8786 if (DWARFDie SpecDie =
8887 Die.getAttributeValueAsReferencedDie (dwarf::DW_AT_specification)) {
@@ -170,7 +169,7 @@ getQualifiedNameIndex(DWARFDie &Die, uint64_t Language, GsymCreator &Gsym) {
170169 // templates
171170 if (ParentName.front () == ' <' && ParentName.back () == ' >' )
172171 Name = " {" + ParentName.substr (1 , ParentName.size () - 2 ).str () + " }" +
173- " ::" + Name;
172+ " ::" + Name;
174173 else
175174 Name = ParentName.str () + " ::" + Name;
176175 }
@@ -338,9 +337,13 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
338337 if (FilePath.empty ()) {
339338 // If we had a DW_AT_decl_file, but got no file then we need to emit a
340339 // warning.
340+ const uint64_t DwarfFileIdx = dwarf::toUnsigned (
341+ Die.findRecursively (dwarf::DW_AT_decl_file), UINT32_MAX);
342+ // Check if there is no DW_AT_decl_line attribute, and don't report an
343+ // error if it isn't there.
344+ if (DwarfFileIdx == UINT32_MAX)
345+ return ;
341346 Out.Report (" Invalid file index in DW_AT_decl_file" , [&](raw_ostream &OS) {
342- const uint64_t DwarfFileIdx = dwarf::toUnsigned (
343- Die.findRecursively (dwarf::DW_AT_decl_file), UINT32_MAX);
344347 OS << " error: function DIE at " << HEX32 (Die.getOffset ())
345348 << " has an invalid file index " << DwarfFileIdx
346349 << " in its DW_AT_decl_file attribute, unable to create a single "
@@ -432,7 +435,7 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
432435 // Skip multiple line entries for the same file and line.
433436 auto LastLE = FI.OptLineTable ->last ();
434437 if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line )
435- continue ;
438+ continue ;
436439 // Only push a row if it isn't an end sequence. End sequence markers are
437440 // included for the last address in a function or the last contiguous
438441 // address in a sequence.
@@ -718,8 +721,8 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
718721 for (uint32_t I = 0 ; I < NumAddrs; ++I) {
719722 auto FuncAddr = Gsym->getAddress (I);
720723 if (!FuncAddr)
721- return createStringError (std::errc::invalid_argument,
722- " failed to extract address[%i]" , I);
724+ return createStringError (std::errc::invalid_argument,
725+ " failed to extract address[%i]" , I);
723726
724727 auto FI = Gsym->getFunctionInfo (*FuncAddr);
725728 if (!FI)
@@ -734,8 +737,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
734737 if (!LR)
735738 return LR.takeError ();
736739
737- auto DwarfInlineInfos =
738- DICtx.getInliningInfoForAddress (SectAddr, DLIS);
740+ auto DwarfInlineInfos = DICtx.getInliningInfoForAddress (SectAddr, DLIS);
739741 uint32_t NumDwarfInlineInfos = DwarfInlineInfos.getNumberOfFrames ();
740742 if (NumDwarfInlineInfos == 0 ) {
741743 DwarfInlineInfos.addFrame (
@@ -773,8 +775,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
773775 continue ;
774776 }
775777
776- for (size_t Idx = 0 , count = LR->Locations .size (); Idx < count;
777- ++Idx) {
778+ for (size_t Idx = 0 , count = LR->Locations .size (); Idx < count; ++Idx) {
778779 const auto &gii = LR->Locations [Idx];
779780 if (Idx < NumDwarfInlineInfos) {
780781 const auto &dii = DwarfInlineInfos.getFrame (Idx);
0 commit comments