summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-08 17:43:26 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-08 17:43:26 +0000
commitdc682bcecccb1b31c22def7e6c3e5e82dd40f6a7 (patch)
tree4e09c2ccd55d53c793bb5e71d4e12a692fe56d35 /include
parent268ab86f6c863468173276d920c16d1ec6de20b0 (diff)
downloadllvm-dc682bcecccb1b31c22def7e6c3e5e82dd40f6a7.tar.gz
llvm-dc682bcecccb1b31c22def7e6c3e5e82dd40f6a7.tar.bz2
llvm-dc682bcecccb1b31c22def7e6c3e5e82dd40f6a7.tar.xz
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/ErrorOr.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h
index 30375ecc90..4f475a0428 100644
--- a/include/llvm/Support/ErrorOr.h
+++ b/include/llvm/Support/ErrorOr.h
@@ -112,15 +112,15 @@ public:
is_error_condition_enum<E>::value,
void *>::type = 0)
: 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) {
- new (getError()) error_code(EC);
+ new (getErrorStorage()) error_code(EC);
}
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) {
@@ -167,7 +167,7 @@ public:
~ErrorOr() {
if (!HasError)
- get()->~storage_type();
+ getStorage()->~storage_type();
}
typedef void (*unspecified_bool_type)();
@@ -179,15 +179,15 @@ public:
}
operator llvm::error_code() const {
- return HasError ? *getError() : llvm::error_code::success();
+ return HasError ? *getErrorStorage() : llvm::error_code::success();
}
pointer operator ->() {
- return toPointer(get());
+ return toPointer(getStorage());
}
reference operator *() {
- return *get();
+ return *getStorage();
}
private:
@@ -196,11 +196,11 @@ private:
if (!Other.HasError) {
// Get the other value.
HasError = false;
- new (get()) storage_type(*Other.get());
+ new (getStorage()) storage_type(*Other.get());
} else {
// Get other's error.
HasError = true;
- new (getError()) error_code(Other);
+ new (getErrorStorage()) error_code(Other);
}
}
@@ -229,11 +229,11 @@ private:
if (!Other.HasError) {
// Get the other value.
HasError = false;
- new (get()) storage_type(std::move(*Other.get()));
+ new (getStorage()) storage_type(std::move(*Other.getStorage()));
} else {
// Get other's error.
HasError = true;
- new (getError()) error_code(Other);
+ new (getErrorStorage()) error_code(Other);
}
}
@@ -255,23 +255,23 @@ private:
return &Val->get();
}
- storage_type *get() {
+ storage_type *getStorage() {
assert(!HasError && "Cannot get value when an error exists!");
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!");
return reinterpret_cast<const storage_type*>(TStorage.buffer);
}
- error_code *getError() {
+ error_code *getErrorStorage() {
assert(HasError && "Cannot get error when a value exists!");
return reinterpret_cast<error_code*>(ErrorStorage.buffer);
}
- const error_code *getError() const {
- return const_cast<ErrorOr<T> *>(this)->getError();
+ const error_code *getErrorStorage() const {
+ return const_cast<ErrorOr<T> *>(this)->getErrorStorage();
}