[llvm] 96ebf9b - [Object] Use std::optional in ELFObjectFile.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 12:44:57 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T12:44:51-08:00
New Revision: 96ebf9bc8016543e404c856cd0839d3bffbbf718

URL: https://github.com/llvm/llvm-project/commit/96ebf9bc8016543e404c856cd0839d3bffbbf718
DIFF: https://github.com/llvm/llvm-project/commit/96ebf9bc8016543e404c856cd0839d3bffbbf718.diff

LOG: [Object] Use std::optional in ELFObjectFile.cpp (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    llvm/lib/Object/ELFObjectFile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 7a88b5976c1c5..e16d275159b6a 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -29,6 +29,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <memory>
+#include <optional>
 #include <string>
 #include <utility>
 
@@ -624,7 +625,7 @@ ELFObjectFileBase::getPltAddresses() const {
       T->createMCInstrAnalysis(MII.get()));
   if (!MIA)
     return {};
-  Optional<SectionRef> Plt, RelaPlt, GotPlt;
+  std::optional<SectionRef> Plt, RelaPlt, GotPlt;
   for (const SectionRef &Section : sections()) {
     Expected<StringRef> NameOrErr = Section.getName();
     if (!NameOrErr) {


        


More information about the llvm-commits mailing list