diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2023-05-01 20:34:51 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2023-05-01 21:08:23 -0700 |
commit | fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef (patch) | |
tree | de943ecab10dba4e794771be711ba6d2633f2fd6 /lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | |
parent | 65365cff3b4ca62d20a6e4588375a48b4f386b69 (diff) | |
download | llvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.zip llvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.tar.gz llvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.tar.bz2 |
[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.
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 5a14234..bfea299 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -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(); |