diff --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h --- a/llvm/lib/Target/BPF/BTFDebug.h +++ b/llvm/lib/Target/BPF/BTFDebug.h @@ -341,12 +341,12 @@ /// Check whether the type is a forward declaration candidate or not. bool IsForwardDeclCandidate(const DIType *Base); - /// Get the file content for the subprogram. Certain lines of the file + /// Get the file content. Certain lines of the file /// later may be put into string table and referenced by line info. - std::string populateFileContent(const DISubprogram *SP); + std::string populateFileContent(const DIFile *File); /// Construct a line info. - void constructLineInfo(const DISubprogram *SP, MCSymbol *Label, uint32_t Line, + void constructLineInfo(const DIFile *File, MCSymbol *Label, uint32_t Line, uint32_t Column); /// Generate types and variables for globals. diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -973,8 +973,7 @@ } /// Read file contents from the actual file or from the source -std::string BTFDebug::populateFileContent(const DISubprogram *SP) { - auto File = SP->getFile(); +std::string BTFDebug::populateFileContent(const DIFile *File) { std::string FileName; if (!File->getFilename().startswith("/") && File->getDirectory().size()) @@ -1005,9 +1004,9 @@ return FileName; } -void BTFDebug::constructLineInfo(const DISubprogram *SP, MCSymbol *Label, +void BTFDebug::constructLineInfo(const DIFile *File, MCSymbol *Label, uint32_t Line, uint32_t Column) { - std::string FileName = populateFileContent(SP); + std::string FileName = populateFileContent(File); BTFLineInfo LineInfo; LineInfo.Label = Label; @@ -1374,7 +1373,7 @@ if (LineInfoGenerated == false) { auto *S = MI->getMF()->getFunction().getSubprogram(); MCSymbol *FuncLabel = Asm->getFunctionBegin(); - constructLineInfo(S, FuncLabel, S->getLine(), 0); + constructLineInfo(S->getFile(), FuncLabel, S->getLine(), 0); LineInfoGenerated = true; } @@ -1386,8 +1385,7 @@ OS.emitLabel(LineSym); // Construct the lineinfo. - auto SP = DL->getScope()->getSubprogram(); - constructLineInfo(SP, LineSym, DL.getLine(), DL.getCol()); + constructLineInfo(DL->getFile(), LineSym, DL.getLine(), DL.getCol()); LineInfoGenerated = true; PrevInstLoc = DL;