mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also clang-format to fix up all the renamed #includes.
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
|
||||
#include "swift/Remote/RemoteAddress.h"
|
||||
#include "swift/SwiftRemoteMirror/MemoryReaderInterface.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include <optional>
|
||||
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
@@ -150,9 +149,9 @@ public:
|
||||
return RemoteAbsolutePointer("", readValue);
|
||||
}
|
||||
|
||||
virtual llvm::Optional<RemoteAbsolutePointer>
|
||||
virtual std::optional<RemoteAbsolutePointer>
|
||||
resolvePointerAsSymbol(RemoteAddress address) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Lookup a symbol for the given remote address.
|
||||
@@ -170,8 +169,8 @@ public:
|
||||
}
|
||||
|
||||
/// Attempt to read and resolve a pointer value at the given remote address.
|
||||
llvm::Optional<RemoteAbsolutePointer> readPointer(RemoteAddress address,
|
||||
unsigned pointerSize) {
|
||||
std::optional<RemoteAbsolutePointer> readPointer(RemoteAddress address,
|
||||
unsigned pointerSize) {
|
||||
// First, try to lookup the pointer as a dynamic symbol (binding), as
|
||||
// reading memory may potentially be expensive.
|
||||
if (auto dynamicSymbol = getDynamicSymbol(address))
|
||||
@@ -179,8 +178,8 @@ public:
|
||||
|
||||
auto result = readBytes(address, pointerSize);
|
||||
if (!result)
|
||||
return llvm::None;
|
||||
|
||||
return std::nullopt;
|
||||
|
||||
uint64_t pointerData;
|
||||
if (pointerSize == 4) {
|
||||
uint32_t theData;
|
||||
@@ -189,7 +188,7 @@ public:
|
||||
} else if (pointerSize == 8) {
|
||||
memcpy(&pointerData, result.get(), 8);
|
||||
} else {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return resolvePointer(address, pointerData);
|
||||
|
||||
Reference in New Issue
Block a user