From a7938c74f16379704fbd38a3d82dfcb9345651ab Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 25 Jun 2022 21:42:52 -0700 Subject: [llvm] Don't use Optional::hasValue (NFC) This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only. --- llvm/lib/Object/ELFObjectFile.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Object/ELFObjectFile.cpp') diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 9bac454..dcd2965 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -167,11 +167,11 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { bool isV7 = false; Optional Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch); - if (Attr.hasValue()) + if (Attr) isV7 = Attr.getValue() == ARMBuildAttrs::v7; Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { case ARMBuildAttrs::ApplicationProfile: Features.AddFeature("aclass"); @@ -190,7 +190,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { } Attr = Attributes.getAttributeValue(ARMBuildAttrs::THUMB_ISA_use); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { default: break; @@ -205,7 +205,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { } Attr = Attributes.getAttributeValue(ARMBuildAttrs::FP_arch); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { default: break; @@ -229,7 +229,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { } Attr = Attributes.getAttributeValue(ARMBuildAttrs::Advanced_SIMD_arch); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { default: break; @@ -248,7 +248,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { } Attr = Attributes.getAttributeValue(ARMBuildAttrs::MVE_arch); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { default: break; @@ -267,7 +267,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { } Attr = Attributes.getAttributeValue(ARMBuildAttrs::DIV_use); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { default: break; @@ -521,7 +521,7 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const { Optional Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch); - if (Attr.hasValue()) { + if (Attr) { switch (Attr.getValue()) { case ARMBuildAttrs::v4: Triple += "v4"; @@ -553,7 +553,7 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const { case ARMBuildAttrs::v7: { Optional ArchProfileAttr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile); - if (ArchProfileAttr.hasValue() && + if (ArchProfileAttr && ArchProfileAttr.getValue() == ARMBuildAttrs::MicroControllerProfile) Triple += "v7m"; else -- cgit v1.1