mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -16,7 +16,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Basic/UUID.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
@@ -66,14 +65,14 @@ swift::UUID::UUID() {
|
||||
#endif
|
||||
}
|
||||
|
||||
llvm::Optional<swift::UUID> swift::UUID::fromString(const char *s) {
|
||||
std::optional<swift::UUID> swift::UUID::fromString(const char *s) {
|
||||
#if defined(_WIN32)
|
||||
RPC_CSTR t = const_cast<RPC_CSTR>(reinterpret_cast<const unsigned char*>(s));
|
||||
|
||||
::UUID uuid;
|
||||
RPC_STATUS status = UuidFromStringA(t, &uuid);
|
||||
if (status == RPC_S_INVALID_STRING_UUID) {
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
swift::UUID result = UUID();
|
||||
@@ -82,7 +81,7 @@ llvm::Optional<swift::UUID> swift::UUID::fromString(const char *s) {
|
||||
#else
|
||||
swift::UUID result;
|
||||
if (uuid_parse(s, result.Value))
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user