Implemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
objects as an objective-c object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index d7a041d..0c97611 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3023,7 +3023,14 @@
if (CompoundType.isNull()) {
// Simple assignment "x = y".
ConvTy = CheckSingleAssignmentConstraints(LHSType, RHS);
-
+ // Special case of NSObject attributes on c-style pointer types.
+ if (ConvTy == IncompatiblePointer &&
+ ((Context.isObjCNSObjectType(LHSType) &&
+ Context.isObjCObjectPointerType(RHSType)) ||
+ (Context.isObjCNSObjectType(RHSType) &&
+ Context.isObjCObjectPointerType(LHSType))))
+ ConvTy = Compatible;
+
// If the RHS is a unary plus or minus, check to see if they = and + are
// right next to each other. If so, the user may have typo'd "x =+ 4"
// instead of "x += 4".