The second part of support for generating dwarf for assembly source files. This

generates the dwarf Compile Unit DIE and a dwarf subprogram DIE for each
non-temporary label.

The next part will be to get the clang driver to enable this when assembling
a .s file.  rdar://9275556


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2011-12-09 18:09:40 +00:00
parent bf67a99c35
commit 94c2e85bea
9 changed files with 554 additions and 0 deletions

View File

@@ -468,6 +468,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
// section and generate a .file directive.
if (getContext().getGenDwarfForAssembly()) {
getContext().setGenDwarfSection(getStreamer().getCurrentSection());
MCSymbol *SectionStartSym = getContext().CreateTempSymbol();
getStreamer().EmitLabel(SectionStartSym);
getContext().setGenDwarfSectionStartSym(SectionStartSym);
getStreamer().EmitDwarfFileDirective(getContext().nextGenDwarfFileNumber(),
StringRef(), SrcMgr.getMemoryBuffer(CurBuffer)->getBufferIdentifier());
}
@@ -1047,6 +1050,12 @@ bool AsmParser::ParseStatement() {
// Emit the label.
Out.EmitLabel(Sym);
// If we are generating dwarf for assembly source files then gather the
// info to make a dwarf subprogram entry for this label if needed.
if (getContext().getGenDwarfForAssembly())
MCGenDwarfSubprogramEntry::Make(Sym, &getStreamer(), getSourceManager(),
IDLoc);
// Consume any end of statement token, if present, to avoid spurious
// AddBlankLine calls().
if (Lexer.is(AsmToken::EndOfStatement)) {