@@ -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.
@@ -722,8 +725,8 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
722725 for (uint32_t I = 0 ; I < NumAddrs; ++I) {
723726 auto FuncAddr = Gsym->getAddress (I);
724727 if (!FuncAddr)
725- return createStringError (std::errc::invalid_argument,
726- " failed to extract address[%i]" , I);
728+ return createStringError (std::errc::invalid_argument,
729+ " failed to extract address[%i]" , I);
727730
728731 auto FI = Gsym->getFunctionInfo (*FuncAddr);
729732 if (!FI)
@@ -738,8 +741,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
738741 if (!LR)
739742 return LR.takeError ();
740743
741- auto DwarfInlineInfos =
742- DICtx.getInliningInfoForAddress (SectAddr, DLIS);
744+ auto DwarfInlineInfos = DICtx.getInliningInfoForAddress (SectAddr, DLIS);
743745 uint32_t NumDwarfInlineInfos = DwarfInlineInfos.getNumberOfFrames ();
744746 if (NumDwarfInlineInfos == 0 ) {
745747 DwarfInlineInfos.addFrame (
@@ -777,8 +779,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
777779 continue ;
778780 }
779781
780- for (size_t Idx = 0 , count = LR->Locations .size (); Idx < count;
781- ++Idx) {
782+ for (size_t Idx = 0 , count = LR->Locations .size (); Idx < count; ++Idx) {
782783 const auto &gii = LR->Locations [Idx];
783784 if (Idx < NumDwarfInlineInfos) {
784785 const auto &dii = DwarfInlineInfos.getFrame (Idx);
0 commit comments