#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <optional>
#include <unordered_map>
namespace llvm {
Error parse(ArrayRef<uint8_t> section, support::endianness endian);
- Optional<unsigned> getAttributeValue(unsigned tag) const {
+ std::optional<unsigned> getAttributeValue(unsigned tag) const {
auto I = attributes.find(tag);
if (I == attributes.end())
- return None;
+ return std::nullopt;
return I->second;
}
- Optional<StringRef> getAttributeString(unsigned tag) const {
+ std::optional<StringRef> getAttributeString(unsigned tag) const {
auto I = attributesStr.find(tag);
if (I == attributesStr.end())
- return None;
+ return std::nullopt;
return I->second;
}
};
// both ARMv7-M and R have to support thumb hardware div
bool isV7 = false;
- Optional<unsigned> Attr =
+ std::optional<unsigned> Attr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
if (Attr)
isV7 = Attr.value() == ARMBuildAttrs::v7;
return Features; // Keep "c" feature if there is one in PlatformFlags.
}
- Optional<StringRef> Attr = Attributes.getAttributeString(RISCVAttrs::ARCH);
+ std::optional<StringRef> Attr =
+ Attributes.getAttributeString(RISCVAttrs::ARCH);
if (Attr) {
// The Arch pattern is [rv32|rv64][i|e]version(_[m|a|f|d|c]version)*
// Version string pattern is (major)p(minor). Major and minor are optional.
else
Triple = "arm";
- Optional<unsigned> Attr =
+ std::optional<unsigned> Attr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
if (Attr) {
switch (Attr.value()) {
Triple += "v6k";
break;
case ARMBuildAttrs::v7: {
- Optional<unsigned> ArchProfileAttr =
+ std::optional<unsigned> ArchProfileAttr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
if (ArchProfileAttr &&
ArchProfileAttr.value() == ARMBuildAttrs::MicroControllerProfile)
ARMAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
- Optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
+ std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
}
CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
- Optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
+ std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
}
CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
- Optional<StringRef> Attr = Parser.getAttributeString(ExpectedTag);
+ std::optional<StringRef> Attr = Parser.getAttributeString(ExpectedTag);
return Attr && *Attr == ExpectedValue;
}
RISCVAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
- Optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
+ std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
}