[DebugInfo] Always emit `.debug_names` with DWARF 5 for Apple platforms
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 14 Jun 2023 20:00:38 +0000 (13:00 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 14 Jun 2023 20:03:31 +0000 (13:03 -0700)
commite0d57295bf6a3c04f2901d9c70f529d570f48b65
treed586d52e182c507d00fbf52cc99ab80e0c11e88d
parentfd68d36109c6fcebb6d758046b88b0664acccf51
[DebugInfo] Always emit `.debug_names` with DWARF 5 for Apple platforms

On Apple platforms, we generate .apple_names, .apple_types,
.apple_namespaces and .apple_objc Apple accelerator tables for DWARF 4
and earlier. For DWARF 5 we should generate .debug_names, but instead we
get no accelerator tables at all.

In the backend we are correctly determining that we should be emitting
.debug_names instead of .apple_names. However, when we get to the point
of emitting the section, if the CU debug name table kind is not
"default", the accelerator table emission is skipped.

This patch sets the DebugNameTableKind to Apple in the frontend when
target an Apple target. That way we know that the CU was compiled with
the intent of emitting accelerator tables. For DWARF 4 and earlier, that
means Apple accelerator tables. For DWARF 5 and later, that means .debug
names.

Differential revision: https://reviews.llvm.org/D118754
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-info-names.c
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/test/DebugInfo/Inputs/name-table-kind-apple-4.ll [new file with mode: 0644]
llvm/test/DebugInfo/Inputs/name-table-kind-apple-5.ll [new file with mode: 0644]
llvm/test/DebugInfo/accel-tables-apple.ll [new file with mode: 0644]