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

Refactor OptionValue 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 20:34:51 -07:00
parent 65365cff3b
commit fdbe7c7faa
13 changed files with 64 additions and 98 deletions

View File

@@ -319,7 +319,8 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
llvm::Triple::EnvironmentType env;
if (module_env_option)
env =
(llvm::Triple::EnvironmentType)module_env_option->GetEnumerationValue();
(llvm::Triple::EnvironmentType)module_env_option->GetEnumerationValue()
.value_or(0);
else
env = GetGlobalPluginProperties().ABI();