mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-27 15:29:51 +00:00
DebugInfo: Simplify retrieving filename/directory name for line table entry building.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
998c1e0c20
commit
44623e8781
@ -1611,32 +1611,12 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,
|
|||||||
StringRef Dir;
|
StringRef Dir;
|
||||||
unsigned Src = 1;
|
unsigned Src = 1;
|
||||||
unsigned Discriminator = 0;
|
unsigned Discriminator = 0;
|
||||||
if (S) {
|
if (DIScope Scope = DIScope(S)) {
|
||||||
DIDescriptor Scope(S);
|
assert(Scope.isScope());
|
||||||
|
Fn = Scope.getFilename();
|
||||||
if (Scope.isCompileUnit()) {
|
Dir = Scope.getDirectory();
|
||||||
DICompileUnit CU(S);
|
if (Scope.isLexicalBlock())
|
||||||
Fn = CU.getFilename();
|
Discriminator = DILexicalBlock(S).getDiscriminator();
|
||||||
Dir = CU.getDirectory();
|
|
||||||
} else if (Scope.isFile()) {
|
|
||||||
DIFile F(S);
|
|
||||||
Fn = F.getFilename();
|
|
||||||
Dir = F.getDirectory();
|
|
||||||
} else if (Scope.isSubprogram()) {
|
|
||||||
DISubprogram SP(S);
|
|
||||||
Fn = SP.getFilename();
|
|
||||||
Dir = SP.getDirectory();
|
|
||||||
} else if (Scope.isLexicalBlockFile()) {
|
|
||||||
DILexicalBlockFile DBF(S);
|
|
||||||
Fn = DBF.getFilename();
|
|
||||||
Dir = DBF.getDirectory();
|
|
||||||
} else if (Scope.isLexicalBlock()) {
|
|
||||||
DILexicalBlock DB(S);
|
|
||||||
Fn = DB.getFilename();
|
|
||||||
Dir = DB.getDirectory();
|
|
||||||
Discriminator = DB.getDiscriminator();
|
|
||||||
} else
|
|
||||||
llvm_unreachable("Unexpected scope info");
|
|
||||||
|
|
||||||
unsigned CUID = Asm->OutStreamer.getContext().getDwarfCompileUnitID();
|
unsigned CUID = Asm->OutStreamer.getContext().getDwarfCompileUnitID();
|
||||||
Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID])
|
Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID])
|
||||||
|
Loading…
Reference in New Issue
Block a user