Teach libc++ about the addressof() overloads it needs to work with
Objective-C Automatic Reference Counting, where Objective-C object
pointers can have several different qualifiers (__strong, __weak,
__autoreleasing, __unsafe_unretained). These addressof() overloads are
only provided in ARC mode, and the __weak variant is conditionalized
on having weak-reference support in the ARC runtime.

For historical reasons, Clang provides these definitions itself, and
defines the macro _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF to note when
it as done so. The code belongs here, and this redundancy will be
eliminated in the future.

Addresses <rdar://problem/9658274>.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133656 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index fea7a96..a943274 100644
--- a/include/__config
+++ b/include/__config
@@ -157,6 +157,15 @@
 #define _LIBCPP_HAS_NO_TRAILING_RETURN
 #endif
 
+// Objective-C++ features (opt-in)
+#if __has_feature(objc_arc)
+#define _LIBCPP_HAS_OBJC_ARC
+#endif
+
+#if __has_feature(objc_arc_weak)
+#define _LIBCPP_HAS_OBJC_ARC_WEAK
+#endif
+
 // Inline namespaces are available in Clang regardless of C++ dialect.
 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
 #define _LIBCPP_END_NAMESPACE_STD  } }