[all-commits] [llvm/llvm-project] e2b3e4: [lldb][NFCI] Unify DW_TAG -> string conversions (#...

Alex Langford via All-commits all-commits at lists.llvm.org
Fri May 3 11:05:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2b3e4ea9f2d0cb34d197439cfbc5090cdacb124
      https://github.com/llvm/llvm-project/commit/e2b3e4ea9f2d0cb34d197439cfbc5090cdacb124
  Author: Alex Langford <alangford at apple.com>
  Date:   2024-05-03 (Fri, 03 May 2024)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

  Log Message:
  -----------
  [lldb][NFCI] Unify DW_TAG -> string conversions (#90657)

The high level goal is to have 1 way of converting a DW_TAG value into a
human-readable string.

There are 3 ways this change accomplishes that:
1.) Changing DW_TAG_value_to_name to not create custom error strings.
  The way it was doing this is error-prone: Specifically, it was using a
  function-local static char buffer and handing out a pointer to it.
  Initialization of this is thread-safe, but mutating it is definitely
  not. Multiple threads that want to call this function could step on
  each others toes. The implementation in this patch sidesteps the issue
  by just returning a StringRef with no mention of the tag value in it.
2.) Changing all uses of DW_TAG_value_to_name to log the value of the
  tag since the function doesn't create a string with the value in it
  anymore.
3.) Removing `DWARFBaseDIE::GetTagAsCString()`. Callers should call
  DW_TAG_value_to_name on the tag directly.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list