diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-11-30 00:38:53 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-11-30 00:38:53 +0000 |
commit | adf0c3d82dbff1480c63f1ebe68c7c1e6bb5828c (patch) | |
tree | a10f4de7a0982b7ffdabdc2cd57707bb31797843 /include/llvm/Support/Compiler.h | |
parent | 1c83093cd5f4f6d33e732c817bb5afd033531beb (diff) |
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
Diffstat (limited to 'include/llvm/Support/Compiler.h')
-rw-r--r-- | include/llvm/Support/Compiler.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 5acc7160ab..7d9785cdae 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -38,6 +38,16 @@ #define llvm_move(value) (value) #endif +/// Expands to '&' if r-value references are supported. +/// +/// This can be used to provide l-value/r-value overrides of member functions. +/// The r-value override should be guarded by LLVM_USE_RVALUE_REFERENCES +#if LLVM_USE_RVALUE_REFERENCES +#define LLVM_LVALUE_FUNCTION & +#else +#define LLVM_LVALUE_FUNCTION +#endif + /// LLVM_DELETED_FUNCTION - Expands to = delete if the compiler supports it. /// Use to mark functions as uncallable. Member functions with this should /// be declared private so that some behavior is kept in C++03 mode. |