[all-commits] [llvm/llvm-project] 8e0001: [lldb][NFCI] Refactor Language::GetFormatterPrefix...

Alex via All-commits all-commits at lists.llvm.org
Tue May 30 13:12:18 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8e0001eb95ce8654660510ddb06f5a8a3c5c6d68
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M lldb/include/lldb/Target/Language.h
    M lldb/source/Plugins/Language/ObjC/CF.cpp
    M lldb/source/Plugins/Language/ObjC/Cocoa.cpp
    M lldb/source/Plugins/Language/ObjC/NSArray.cpp
    M lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
    M lldb/source/Plugins/Language/ObjC/NSSet.cpp
    M lldb/source/Plugins/Language/ObjC/NSString.cpp
    M lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
    M lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
    M lldb/source/Target/Language.cpp

  Log Message:
  [lldb][NFCI] Refactor Language::GetFormatterPrefixSuffix

- Remove unused parameter `valobj` (I checked downstream, not
  even swift is using it).
- Return a std::pair<StringRef, StringRef> insted of having 2 out
  parameter strings.
- Remove the use of ConstStrings.

This change was primarily mechanical except in
`ObjCLanguage::GetFormatterPrefixSuffix`. To keep this fast, we
construct an llvm::StringMap<std::pair<StringRef, StringRef>> so that we
can look things up quickly. There is some amount of cost to setting up
the map the first time it is called, but subsequent lookups should be
as fast as a hash + string comparison (the cost of looking up something
in an llvm::StringMap).

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

More information about the All-commits mailing list