[all-commits] [llvm/llvm-project] 2ec334: [lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form

Alex via All-commits all-commits at lists.llvm.org
Wed May 10 11:24:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ec334dc7b7329c6b71faa037a0d926e8e130c20
      https://github.com/llvm/llvm-project/commit/2ec334dc7b7329c6b71faa037a0d926e8e130c20
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M lldb/include/lldb/Core/dwarf.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
    M lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp

  Log Message:
  -----------
  [lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form

LLDB currently defines `dw_form_t` as a `uint16_t` which makes sense.
However, LLVM also defines a similar type `llvm::dwarf::Form` which is
an enum backed by a `uint16_t`. Switching to the llvm implementation
means that we can more easily interoperate with the LLVM DWARF code.

Additionally, we get some type checking out of this: I found that
DWARFAttribute had a method called `FormAtIndex` that returned a
`dw_attr_t`. Although `dw_attr_t` is also a `uint16_t` under the hood,
the type checking benefits here are undeniable: If this had returned a
something of different signedness/width, we could have had some bad
bugs.

Differential Revision: https://reviews.llvm.org/D150228




More information about the All-commits mailing list