diff options
author | Fangrui Song <i@maskray.me> | 2022-12-16 22:44:08 +0000 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-12-16 22:44:08 +0000 |
commit | 2fa744e631cbabe583da010ec56560edbc7a5384 (patch) | |
tree | db931423c9394a852b65bdf5072ba997463114d5 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 27249c06b775c73b7fa9f2d8e48cac1a85169481 (diff) | |
download | llvm-2fa744e631cbabe583da010ec56560edbc7a5384.zip llvm-2fa744e631cbabe583da010ec56560edbc7a5384.tar.gz llvm-2fa744e631cbabe583da010ec56560edbc7a5384.tar.bz2 |
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This commit fixes LLVMAnalysis and its dependencies.
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index a3593eae..6b29703 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -169,11 +169,11 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { std::optional<unsigned> Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch); if (Attr) - isV7 = Attr.value() == ARMBuildAttrs::v7; + isV7 = *Attr == ARMBuildAttrs::v7; Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { case ARMBuildAttrs::ApplicationProfile: Features.AddFeature("aclass"); break; @@ -192,7 +192,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { Attr = Attributes.getAttributeValue(ARMBuildAttrs::THUMB_ISA_use); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { default: break; case ARMBuildAttrs::Not_Allowed: @@ -207,7 +207,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { Attr = Attributes.getAttributeValue(ARMBuildAttrs::FP_arch); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { default: break; case ARMBuildAttrs::Not_Allowed: @@ -231,7 +231,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { Attr = Attributes.getAttributeValue(ARMBuildAttrs::Advanced_SIMD_arch); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { default: break; case ARMBuildAttrs::Not_Allowed: @@ -250,7 +250,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { Attr = Attributes.getAttributeValue(ARMBuildAttrs::MVE_arch); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { default: break; case ARMBuildAttrs::Not_Allowed: @@ -269,7 +269,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { Attr = Attributes.getAttributeValue(ARMBuildAttrs::DIV_use); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { default: break; case ARMBuildAttrs::DisallowDIV: @@ -546,7 +546,7 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const { std::optional<unsigned> Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch); if (Attr) { - switch (Attr.value()) { + switch (*Attr) { case ARMBuildAttrs::v4: Triple += "v4"; break; @@ -578,7 +578,7 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const { std::optional<unsigned> ArchProfileAttr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile); if (ArchProfileAttr && - ArchProfileAttr.value() == ARMBuildAttrs::MicroControllerProfile) + *ArchProfileAttr == ARMBuildAttrs::MicroControllerProfile) Triple += "v7m"; else Triple += "v7"; |