Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1128,21 +1128,6 @@ // Add the range of this function to the list of ranges for the CU. TheCU.addRange(RangeSpan(Asm->getFunctionBegin(), Asm->getFunctionEnd())); - // Under -gmlt, skip building the subprogram if there are no inlined - // subroutines inside it. - if (TheCU.getCUNode()->getEmissionKind() == DICompileUnit::LineTablesOnly && - LScopes.getAbstractScopesList().empty() && !IsDarwin) { - assert(InfoHolder.getScopeVariables().empty()); - assert(DbgValues.empty()); - // FIXME: This wouldn't be true in LTO with a -g (with inlining) CU followed - // by a -gmlt CU. Add a test and remove this assertion. - assert(AbstractVariables.empty()); - PrevLabel = nullptr; - CurFn = nullptr; - DebugHandlerBase::endFunction(MF); - return; - } - #ifndef NDEBUG size_t NumAbstractScopes = LScopes.getAbstractScopesList().size(); #endif Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1176,20 +1176,19 @@ void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal) { - if (!Minimal) - if (applySubprogramDefinitionAttributes(SP, SPDie)) - return; + if (applySubprogramDefinitionAttributes(SP, SPDie)) + return; // Constructors and operators for anonymous aggregates do not have names. if (!SP->getName().empty()) addString(SPDie, dwarf::DW_AT_name, SP->getName()); + addSourceLine(SPDie, SP); + // Skip the rest of the attributes under -gmlt to save space. if (Minimal) return; - addSourceLine(SPDie, SP); - // Add the prototype if we have a prototype and we have a C like // language. uint16_t Language = getLanguage();