OSDN Git Service

Replace redundant code in FormatManager and FormatCache with templates (NFC)
authorAdrian Prantl <aprantl@apple.com>
Tue, 10 Dec 2019 00:22:26 +0000 (16:22 -0800)
committerAdrian Prantl <aprantl@apple.com>
Tue, 10 Dec 2019 18:27:16 +0000 (10:27 -0800)
commit7034794b314d9de808de004d22b47f18d134757d
tree9aadd983ec189fe227b341f47f31e2a783bb35f7
parent49da20ddb4319f3f469499e341a1bc3101adcdcf
Replace redundant code in FormatManager and FormatCache with templates (NFC)

This is a preparatory patch for an upcoming bugfix.

FormatManager and friends have four identical implementations of many
accessor functions to deal with the four types of shared pointers in
the FormatCache. This patch replaces these implementations with
templates. While this patch drastically reduces the amount of source
code and its maintainablity, it doesn't actually improve code
size. I'd argue, this is still an improvement.

rdar://problem/57756763

Differential Revision: https://reviews.llvm.org/D71231
lldb/include/lldb/DataFormatters/FormatCache.h
lldb/include/lldb/DataFormatters/FormatManager.h
lldb/include/lldb/DataFormatters/TypeCategoryMap.h
lldb/source/DataFormatters/FormatCache.cpp
lldb/source/DataFormatters/FormatManager.cpp
lldb/source/DataFormatters/LanguageCategory.cpp
lldb/source/DataFormatters/TypeCategoryMap.cpp