diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-09-29 18:10:17 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-09-29 18:10:17 +0000 |
| commit | 32d072ca455b1a82116501a0b87c455ce71a9862 (patch) | |
| tree | bf047ba3eea24b6cf6dbb47322451f6884a8bbb0 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 82237f2f423d8008aebfb969498ff2754d45483a (diff) | |
| download | bcm5719-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/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 14 |
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); |

