[lldb] Refactor OptionValueProperties to return a std::optional (NFC)

Similar to fdbe7c7faa, refactor OptionValueProperties to return a
std::optional instead of taking a fail value. This allows the caller to
handle situations where there's no value, instead of being unable to
distinguish between the absence of a value and the value happening the
match the fail value. When a fail value is required,
std::optional::value_or() provides the same functionality.
This commit is contained in:
Jonas Devlieghere
2023-05-01 21:04:24 -07:00
parent 3b8bc83527
commit 9c48aa68f4
17 changed files with 318 additions and 293 deletions

View File

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