mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 02:22:29 +00:00
Rename get to getStorage and getError to getErrorStorage.
These private functions return pointers to the internal storage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -112,15 +112,15 @@ public:
|
|||||||
is_error_condition_enum<E>::value,
|
is_error_condition_enum<E>::value,
|
||||||
void *>::type = 0)
|
void *>::type = 0)
|
||||||
: HasError(true) {
|
: HasError(true) {
|
||||||
new (getError()) error_code(make_error_code(ErrorCode));
|
new (getErrorStorage()) error_code(make_error_code(ErrorCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr(llvm::error_code EC) : HasError(true) {
|
ErrorOr(llvm::error_code EC) : HasError(true) {
|
||||||
new (getError()) error_code(EC);
|
new (getErrorStorage()) error_code(EC);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr(T Val) : HasError(false) {
|
ErrorOr(T Val) : HasError(false) {
|
||||||
new (get()) storage_type(moveIfMoveConstructible<storage_type>(Val));
|
new (getStorage()) storage_type(moveIfMoveConstructible<storage_type>(Val));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr(const ErrorOr &Other) {
|
ErrorOr(const ErrorOr &Other) {
|
||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
|
|
||||||
~ErrorOr() {
|
~ErrorOr() {
|
||||||
if (!HasError)
|
if (!HasError)
|
||||||
get()->~storage_type();
|
getStorage()->~storage_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*unspecified_bool_type)();
|
typedef void (*unspecified_bool_type)();
|
||||||
@@ -179,15 +179,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
operator llvm::error_code() const {
|
operator llvm::error_code() const {
|
||||||
return HasError ? *getError() : llvm::error_code::success();
|
return HasError ? *getErrorStorage() : llvm::error_code::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer operator ->() {
|
pointer operator ->() {
|
||||||
return toPointer(get());
|
return toPointer(getStorage());
|
||||||
}
|
}
|
||||||
|
|
||||||
reference operator *() {
|
reference operator *() {
|
||||||
return *get();
|
return *getStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -196,11 +196,11 @@ private:
|
|||||||
if (!Other.HasError) {
|
if (!Other.HasError) {
|
||||||
// Get the other value.
|
// Get the other value.
|
||||||
HasError = false;
|
HasError = false;
|
||||||
new (get()) storage_type(*Other.get());
|
new (getStorage()) storage_type(*Other.get());
|
||||||
} else {
|
} else {
|
||||||
// Get other's error.
|
// Get other's error.
|
||||||
HasError = true;
|
HasError = true;
|
||||||
new (getError()) error_code(Other);
|
new (getErrorStorage()) error_code(Other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,11 +229,11 @@ private:
|
|||||||
if (!Other.HasError) {
|
if (!Other.HasError) {
|
||||||
// Get the other value.
|
// Get the other value.
|
||||||
HasError = false;
|
HasError = false;
|
||||||
new (get()) storage_type(std::move(*Other.get()));
|
new (getStorage()) storage_type(std::move(*Other.getStorage()));
|
||||||
} else {
|
} else {
|
||||||
// Get other's error.
|
// Get other's error.
|
||||||
HasError = true;
|
HasError = true;
|
||||||
new (getError()) error_code(Other);
|
new (getErrorStorage()) error_code(Other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,23 +255,23 @@ private:
|
|||||||
return &Val->get();
|
return &Val->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
storage_type *get() {
|
storage_type *getStorage() {
|
||||||
assert(!HasError && "Cannot get value when an error exists!");
|
assert(!HasError && "Cannot get value when an error exists!");
|
||||||
return reinterpret_cast<storage_type*>(TStorage.buffer);
|
return reinterpret_cast<storage_type*>(TStorage.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const storage_type *get() const {
|
const storage_type *getStorage() const {
|
||||||
assert(!HasError && "Cannot get value when an error exists!");
|
assert(!HasError && "Cannot get value when an error exists!");
|
||||||
return reinterpret_cast<const storage_type*>(TStorage.buffer);
|
return reinterpret_cast<const storage_type*>(TStorage.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code *getError() {
|
error_code *getErrorStorage() {
|
||||||
assert(HasError && "Cannot get error when a value exists!");
|
assert(HasError && "Cannot get error when a value exists!");
|
||||||
return reinterpret_cast<error_code*>(ErrorStorage.buffer);
|
return reinterpret_cast<error_code*>(ErrorStorage.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const error_code *getError() const {
|
const error_code *getErrorStorage() const {
|
||||||
return const_cast<ErrorOr<T> *>(this)->getError();
|
return const_cast<ErrorOr<T> *>(this)->getErrorStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user