[PATCH] D140448: [BOLT][NFC] Use std::optional in RewriteInstance
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 18:31:08 PST 2022
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140448
Files:
bolt/include/bolt/Core/BinaryContext.h
bolt/lib/Rewrite/MachORewriteInstance.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -4762,7 +4762,7 @@
assert(SymbolName && "cannot get symbol name");
auto updateSymbolValue = [&](const StringRef Name,
- Optional<uint64_t> Value = std::nullopt) {
+ std::optional<uint64_t> Value = std::nullopt) {
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
NewSymbol.st_shndx = ELF::SHN_ABS;
outs() << "BOLT-INFO: setting " << Name << " to 0x"
Index: bolt/lib/Rewrite/MachORewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/MachORewriteInstance.cpp
+++ bolt/lib/Rewrite/MachORewriteInstance.cpp
@@ -197,9 +197,9 @@
return DataInCode;
}
-Optional<uint64_t> readStartAddress(const MachOObjectFile &O) {
- Optional<uint64_t> StartOffset;
- Optional<uint64_t> TextVMAddr;
+std::optional<uint64_t> readStartAddress(const MachOObjectFile &O) {
+ std::optional<uint64_t> StartOffset;
+ std::optional<uint64_t> TextVMAddr;
for (const object::MachOObjectFile::LoadCommandInfo &LC : O.load_commands()) {
switch (LC.C.cmd) {
case MachO::LC_MAIN: {
@@ -228,7 +228,7 @@
}
}
return (TextVMAddr && StartOffset)
- ? Optional<uint64_t>(*TextVMAddr + *StartOffset)
+ ? std::optional<uint64_t>(*TextVMAddr + *StartOffset)
: std::nullopt;
}
Index: bolt/include/bolt/Core/BinaryContext.h
===================================================================
--- bolt/include/bolt/Core/BinaryContext.h
+++ bolt/include/bolt/Core/BinaryContext.h
@@ -650,11 +650,11 @@
/// Address of the code/function that is executed before any other code in
/// the binary.
- Optional<uint64_t> StartFunctionAddress;
+ std::optional<uint64_t> StartFunctionAddress;
/// Address of the code/function that is going to be executed right before
/// the execution of the binary is completed.
- Optional<uint64_t> FiniFunctionAddress;
+ std::optional<uint64_t> FiniFunctionAddress;
/// Page alignment used for code layout.
uint64_t PageAlign{HugePageSize};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140448.484441.patch
Type: text/x-patch
Size: 2287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221221/6a0a03a2/attachment.bin>
More information about the llvm-commits
mailing list