Index: lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp =================================================================== --- lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp +++ lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp @@ -179,22 +179,6 @@ Streamer.EmitValue(AddrDelta, Size); } -const DISubprogram getDISubprogram(const Function &F, const LLVMContext &Ctx) { - for (auto &BI : F) { - const BasicBlock *BB = &BI; - for (auto &Inst : BB->getInstList()) { - DebugLoc DLoc = Inst.getDebugLoc(); - if (DLoc.isUnknown()) - continue; - const MDNode *Scope = DLoc.getScopeNode(Ctx); - DISubprogram Subprogram = getDISubprogram(Scope); - return Subprogram.describes(&F) ? Subprogram : DISubprogram(); - } - } - - return DISubprogram(); -} - void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) { // For each function there is a separate subsection // which holds the PC to file:line table. @@ -206,10 +190,7 @@ return; assert(FI.End && "Don't know where the function ends?"); - // FIXME: Find a way to get the demangled function name. - const StringRef FuncName = getDISubprogram(*GV, GV->getParent()->getContext()).getDisplayName(); - printf("ZZZ ---%s---\n", FuncName.str().c_str()); - fflush(0); + const StringRef FuncName = getDISubprogram(GV).getDisplayName(); // Emit a symbol subsection, required by VS2012+ to find function boundaries. MCSymbol *SymbolsBegin = Asm->MMI->getContext().CreateTempSymbol(), *SymbolsEnd = Asm->MMI->getContext().CreateTempSymbol(); Index: test/DebugInfo/COFF/simple.ll =================================================================== --- test/DebugInfo/COFF/simple.ll +++ test/DebugInfo/COFF/simple.ll @@ -34,14 +34,14 @@ ; X86-NEXT: .secrel32 _f ; X86-NEXT: .secidx _f ; X86-NEXT: .byte 0 -; X86-NEXT: .ascii "_f" +; X86-NEXT: .byte 102 ; X86-NEXT: .byte 0 ; X86-NEXT: [[PROC_SEGMENT_END]]: ; X86-NEXT: .short 2 ; X86-NEXT: .short 4431 ; X86-NEXT: [[F1_END]]: ; Padding -; X86-NEXT: .zero 2 +; X86-NEXT: .zero 3 ; Line table ; X86-NEXT: .long 242 ; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]] @@ -88,7 +88,7 @@ ; OBJ32-NEXT: Type: 0xF1 ; OBJ32-NOT: ] ; OBJ32: ProcStart { -; OBJ32-NEXT: FunctionName: _f +; OBJ32-NEXT: FunctionName: f ; OBJ32-NEXT: Section: _f ; OBJ32-NEXT: CodeSize: 0x6 ; OBJ32-NEXT: }