diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-05-15 20:18:50 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-05-15 20:18:50 +0000 |
commit | 4c6d987b069dc5738318ec0fa7c040e34ad84127 (patch) | |
tree | 95f2d93d0543443c8e5c336a6824bf68b2287f89 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | f0915aa0e661d931922dcca27e51973ddbfa55a9 (diff) | |
download | bcm5719-llvm-4c6d987b069dc5738318ec0fa7c040e34ad84127.tar.gz bcm5719-llvm-4c6d987b069dc5738318ec0fa7c040e34ad84127.zip |
DebugInfo: Simplify retrieving filename/directory name for line table entry building.
llvm-svn: 208911
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5585f253918..94041324830 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1611,32 +1611,12 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, StringRef Dir; unsigned Src = 1; unsigned Discriminator = 0; - if (S) { - DIDescriptor Scope(S); - - if (Scope.isCompileUnit()) { - DICompileUnit CU(S); - Fn = CU.getFilename(); - 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"); + if (DIScope Scope = DIScope(S)) { + assert(Scope.isScope()); + Fn = Scope.getFilename(); + Dir = Scope.getDirectory(); + if (Scope.isLexicalBlock()) + Discriminator = DILexicalBlock(S).getDiscriminator(); unsigned CUID = Asm->OutStreamer.getContext().getDwarfCompileUnitID(); Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID]) |