mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
Add a new C++11 compatibility macro, LLVM_LVALUE_FUNCTION.
This expands to '&', and is intended to be used when an /optional/ rvalue override is available. Before: void foo() const { ... } After: void foo() const LLVM_LVALUE_FUNCTION { ... } void foo() && { ... } This is used to allow moving the contents of an Optional. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -48,12 +48,17 @@ public:
|
||||
}
|
||||
|
||||
const T* getPointer() const { assert(hasVal); return &x; }
|
||||
const T& getValue() const { assert(hasVal); return x; }
|
||||
const T& getValue() const LLVM_LVALUE_FUNCTION { assert(hasVal); return x; }
|
||||
|
||||
operator bool() const { return hasVal; }
|
||||
bool hasValue() const { return hasVal; }
|
||||
const T* operator->() const { return getPointer(); }
|
||||
const T& operator*() const { assert(hasVal); return x; }
|
||||
const T& operator*() const LLVM_LVALUE_FUNCTION { assert(hasVal); return x; }
|
||||
|
||||
#if LLVM_USE_RVALUE_REFERENCES
|
||||
T&& getValue() && { assert(hasVal); return std::move(x); }
|
||||
T&& operator*() && { assert(hasVal); return std::move(x); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T> struct simplify_type;
|
||||
|
Reference in New Issue
Block a user