diff options
| author | Devang Patel <dpatel@apple.com> | 2009-08-31 22:47:13 +0000 | 
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-08-31 22:47:13 +0000 | 
| commit | b2de5fa6891b3c1f751b26bd8d0bea978a274d54 (patch) | |
| tree | 032ac34291db1ca8e780e3b22fd6693f2f4bcef3 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
| parent | 759e32bdc69968ec9ada4781b34894bb72fede43 (diff) | |
| download | bcm5719-llvm-b2de5fa6891b3c1f751b26bd8d0bea978a274d54.tar.gz bcm5719-llvm-b2de5fa6891b3c1f751b26bd8d0bea978a274d54.zip | |
Subprogram is a scope. Derive DISubprogram from DIScope.
llvm-svn: 80637
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f7e782c794a..0e55b545833 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -487,6 +487,23 @@ void DwarfDebug::AddSourceLine(DIE *Die, const DIGlobal *G) {    AddUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);    AddUInt(Die, dwarf::DW_AT_decl_line, 0, Line);  } + +/// AddSourceLine - Add location information to specified debug information +/// entry. +void DwarfDebug::AddSourceLine(DIE *Die, const DISubprogram *SP) { +  // If there is no compile unit specified, don't add a line #. +  if (SP->getCompileUnit().isNull()) +    return; + +  unsigned Line = SP->getLineNumber(); +  unsigned FileID = FindCompileUnit(SP->getCompileUnit()).getID(); +  assert(FileID && "Invalid file id"); +  AddUInt(Die, dwarf::DW_AT_decl_file, 0, FileID); +  AddUInt(Die, dwarf::DW_AT_decl_line, 0, Line); +} + +/// AddSourceLine - Add location information to specified debug information +/// entry.  void DwarfDebug::AddSourceLine(DIE *Die, const DIType *Ty) {    // If there is no compile unit specified, don't add a line #.    DICompileUnit CU = Ty->getCompileUnit(); | 

