diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -494,6 +494,7 @@ void DwarfDebug::addSubprogramNames(const DICompileUnit &CU, const DISubprogram *SP, DIE &Die) { if (getAccelTableKind() != AccelTableKind::Apple && + CU.getNameTableKind() != DICompileUnit::DebugNameTableKind::Apple && CU.getNameTableKind() == DICompileUnit::DebugNameTableKind::None) return; @@ -3539,6 +3540,7 @@ return; if (getAccelTableKind() != AccelTableKind::Apple && + CU.getNameTableKind() != DICompileUnit::DebugNameTableKind::Apple && CU.getNameTableKind() != DICompileUnit::DebugNameTableKind::Default) return; diff --git a/llvm/test/DebugInfo/accel-tables-apple.ll b/llvm/test/DebugInfo/accel-tables-apple.ll --- a/llvm/test/DebugInfo/accel-tables-apple.ll +++ b/llvm/test/DebugInfo/accel-tables-apple.ll @@ -1,8 +1,9 @@ ; Verify the emission of accelerator tables for nameTableKind: Apple ; REQUIRES: x86-registered-target -; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %S/Inputs/name-table-kind-apple-5.ll \ -; RUN: | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s +; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.d5.o < %S/Inputs/name-table-kind-apple-5.ll +; RUN: llvm-readobj --sections %t.d5.o | FileCheck --check-prefix=DEBUG_NAMES %s +; RUN: llvm-dwarfdump --debug-names %t.d5.o | FileCheck --check-prefix=COUNT_DEBUG_NAMES %s ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %S/Inputs/name-table-kind-apple-4.ll \ ; RUN: | llvm-readobj --sections - | FileCheck --check-prefix=APPLE %s @@ -18,3 +19,5 @@ ; DEBUG_NAMES: debug_names ; DEBUG_NAMES-NOT: apple_names ; DEBUG_NAMES-NOT: pubnames + +; COUNT_DEBUG_NAMES: Name count: 4