diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-25 21:42:52 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-25 21:42:52 -0700 |
commit | a7938c74f16379704fbd38a3d82dfcb9345651ab (patch) | |
tree | c60b0dce73b749e64ab20d51ef00abfbc547857f /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 77295c5486e48a4319efcfc4ac262304c7e7025c (diff) | |
download | llvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.zip llvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.tar.gz llvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.tar.bz2 |
[llvm] Don't use Optional::hasValue (NFC)
This patch replaces Optional::hasValue with the implicit cast to bool
in conditionals only.
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 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<unsigned> 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<unsigned> 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<unsigned> ArchProfileAttr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile); - if (ArchProfileAttr.hasValue() && + if (ArchProfileAttr && ArchProfileAttr.getValue() == ARMBuildAttrs::MicroControllerProfile) Triple += "v7m"; else |