From: Amir Ayupov Date: Sun, 11 Dec 2022 20:28:08 +0000 (-0800) Subject: [BOLT][NFC] Use std::optional in RI X-Git-Tag: upstream/17.0.6~24289 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e5b4dacf30eb82506b672b1a9469924c8f8f6d3;p=platform%2Fupstream%2Fllvm.git [BOLT][NFC] Use std::optional in RI --- diff --git a/bolt/include/bolt/Rewrite/RewriteInstance.h b/bolt/include/bolt/Rewrite/RewriteInstance.h index 1abad87..91cc41f 100644 --- a/bolt/include/bolt/Rewrite/RewriteInstance.h +++ b/bolt/include/bolt/Rewrite/RewriteInstance.h @@ -81,7 +81,7 @@ public: /// The build-id is typically a stream of 20 bytes. Return these bytes in /// printable hexadecimal form if they are available, or std::nullopt /// otherwise. - Optional getPrintableBuildID() const; + std::optional getPrintableBuildID() const; /// If this instance uses a profile, return appropriate profile reader. const ProfileReaderBase *getProfileReader() const { @@ -475,12 +475,12 @@ private: uint64_t NextAvailableAddress{0}; /// Location and size of dynamic relocations. - Optional DynamicRelocationsAddress; + std::optional DynamicRelocationsAddress; uint64_t DynamicRelocationsSize{0}; uint64_t DynamicRelativeRelocationsCount{0}; /// PLT relocations are special kind of dynamic relocations stored separately. - Optional PLTRelocationsAddress; + std::optional PLTRelocationsAddress; uint64_t PLTRelocationsSize{0}; /// True if relocation of specified type came from .rela.plt diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 774a4d3..f5542c985 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -30,7 +30,6 @@ #include "bolt/RuntimeLibs/InstrumentationRuntimeLibrary.h" #include "bolt/Utils/CommandLineOpts.h" #include "bolt/Utils/Utils.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h" @@ -679,7 +678,7 @@ void RewriteInstance::parseBuildID() { BuildID = Buf.slice(Offset, Offset + DescSz); } -Optional RewriteInstance::getPrintableBuildID() const { +std::optional RewriteInstance::getPrintableBuildID() const { if (BuildID.empty()) return std::nullopt; @@ -1683,7 +1682,7 @@ Error RewriteInstance::readSpecialSections() { // Parse build-id parseBuildID(); - if (Optional FileBuildID = getPrintableBuildID()) + if (std::optional FileBuildID = getPrintableBuildID()) BC->setFileBuildID(*FileBuildID); parseSDTNotes();