summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-09-29 18:10:17 +0000
committerSteve Naroff <snaroff@apple.com>2008-09-29 18:10:17 +0000
commit32d072ca455b1a82116501a0b87c455ce71a9862 (patch)
treebf047ba3eea24b6cf6dbb47322451f6884a8bbb0 /clang/lib
parent82237f2f423d8008aebfb969498ff2754d45483a (diff)
downloadbcm5719-llvm-32d072ca455b1a82116501a0b87c455ce71a9862.tar.gz
bcm5719-llvm-32d072ca455b1a82116501a0b87c455ce71a9862.zip
Teach Sema::CheckAssignmentConstraints() to allow assignments between id and block pointer types (^{}).
llvm-svn: 56793
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 269db214b70..b19da68abee 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1653,10 +1653,15 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) {
if (isa<PointerType>(rhsType))
return CheckPointerTypesForAssignment(lhsType, rhsType);
- if (rhsType->getAsBlockPointerType())
+ if (rhsType->getAsBlockPointerType()) {
if (lhsType->getAsPointerType()->getPointeeType()->isVoidType())
return BlockVoidPointer;
-
+
+ // Treat block pointers as objects.
+ if (getLangOptions().ObjC1 &&
+ lhsType == Context.getCanonicalType(Context.getObjCIdType()))
+ return Compatible;
+ }
return Incompatible;
}
@@ -1664,6 +1669,11 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) {
if (rhsType->isIntegerType())
return IntToPointer;
+ // Treat block pointers as objects.
+ if (getLangOptions().ObjC1 &&
+ rhsType == Context.getCanonicalType(Context.getObjCIdType()))
+ return Compatible;
+
if (rhsType->isBlockPointerType())
return CheckBlockPointerTypesForAssignment(lhsType, rhsType);
OpenPOWER on IntegriCloud