[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)

Use templates to simplify {Get,Set}PropertyAtIndex. It has always
bothered me how cumbersome those calls are when adding new properties.
After this patch, SetPropertyAtIndex infers the type from its arguments
and GetPropertyAtIndex required a single template argument for the
return value. As an added benefit, this enables us to remove a bunch of
wrappers from UserSettingsController and OptionValueProperties.

Differential revision: https://reviews.llvm.org/D149774
This commit is contained in:
Jonas Devlieghere
2023-05-04 09:26:58 -07:00
parent 04aa943be8
commit 6f8b33f6df
22 changed files with 446 additions and 525 deletions

View File

@@ -90,9 +90,8 @@ public:
}
llvm::Triple::EnvironmentType ABI() const {
return (llvm::Triple::EnvironmentType)m_collection_sp
->GetPropertyAtIndexAsEnumeration(ePropertyABI)
.value_or(llvm::Triple::UnknownEnvironment);
return GetPropertyAtIndexAs<llvm::Triple::EnvironmentType>(
ePropertyABI, llvm::Triple::UnknownEnvironment);
}
OptionValueDictionary *ModuleABIMap() const {