[lldb][NFCI] Refactor Language::GetFormatterPrefixSuffix
authorAlex Langford <alangford@apple.com>
Sat, 27 May 2023 01:26:49 +0000 (18:26 -0700)
committerAlex Langford <alangford@apple.com>
Tue, 30 May 2023 20:11:55 +0000 (13:11 -0700)
commit8e0001eb95ce8654660510ddb06f5a8a3c5c6d68
treebc3727d48d089cf353b044c03d0ab22244cf279e
parent19ef02e3f4f82a439a94479589a9f1244d0b1b06
[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
lldb/include/lldb/Target/Language.h
lldb/source/Plugins/Language/ObjC/CF.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp
lldb/source/Plugins/Language/ObjC/NSString.cpp
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
lldb/source/Target/Language.cpp