[llvm] r198774 - Rename get to getStorage and getError to getErrorStorage.

Rafael Espindola rafael.espindola at gmail.com
Wed Jan 8 09:43:26 PST 2014


Author: rafael
Date: Wed Jan  8 11:43:26 2014
New Revision: 198774

URL: http://llvm.org/viewvc/llvm-project?rev=198774&view=rev
Log:
Rename get to getStorage and getError to getErrorStorage.

These private functions return pointers to the internal storage.

Modified:
    llvm/trunk/include/llvm/Support/ErrorOr.h

Modified: llvm/trunk/include/llvm/Support/ErrorOr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorOr.h?rev=198774&r1=198773&r2=198774&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ErrorOr.h (original)
+++ llvm/trunk/include/llvm/Support/ErrorOr.h Wed Jan  8 11:43:26 2014
@@ -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();
   }
 
 





More information about the llvm-commits mailing list