From 731f7b3ccbdf9535fbbdf8a31763d768a146c94b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 8 Jan 2014 17:43:26 +0000 Subject: [PATCH] Rename get to getStorage and getError to getErrorStorage. These private functions return pointers to the internal storage. llvm-svn: 198774 --- include/llvm/Support/ErrorOr.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h index 30375ecc904..4f475a04284 100644 --- a/include/llvm/Support/ErrorOr.h +++ b/include/llvm/Support/ErrorOr.h @@ -112,15 +112,15 @@ public: is_error_condition_enum::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(Val)); + new (getStorage()) storage_type(moveIfMoveConstructible(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(TStorage.buffer); } - const storage_type *get() const { + const storage_type *getStorage() const { assert(!HasError && "Cannot get value when an error exists!"); return reinterpret_cast(TStorage.buffer); } - error_code *getError() { + error_code *getErrorStorage() { assert(HasError && "Cannot get error when a value exists!"); return reinterpret_cast(ErrorStorage.buffer); } - const error_code *getError() const { - return const_cast *>(this)->getError(); + const error_code *getErrorStorage() const { + return const_cast *>(this)->getErrorStorage(); }