diff options
| author | Steve Naroff <snaroff@apple.com> | 2009-07-29 15:09:39 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2009-07-29 15:09:39 +0000 |
| commit | 85d9715c2425e452f87b04423376da26441f7d2d (patch) | |
| tree | 76f603e96116ed5325dc048df74bc6d9311c9119 /clang/lib | |
| parent | d390fd99d9886add3a53b21cc575fede92b55b1f (diff) | |
| download | bcm5719-llvm-85d9715c2425e452f87b04423376da26441f7d2d.tar.gz bcm5719-llvm-85d9715c2425e452f87b04423376da26441f7d2d.zip | |
Fix <rdar://problem/7100524> regression: "error: incompatible operand types ('void *' and 'NSString *')".
Remove XFAIL from 'conditional-expr-4.m' test case (which would have caught this).
Also tweaked several aspects of the test to jive with the current type checking.
llvm-svn: 77453
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 9114c0b5c19..dd5bfc4e880 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3206,6 +3206,25 @@ QualType Sema::CheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS, ImpCastExprToType(RHS, compositeType); return compositeType; } + // Check Objective-C object pointer types and 'void *' + if (LHSTy->isVoidPointerType() && RHSTy->isObjCObjectPointerType()) { + QualType lhptee = LHSTy->getAsPointerType()->getPointeeType(); + QualType rhptee = RHSTy->getAsObjCObjectPointerType()->getPointeeType(); + QualType destPointee = lhptee.getQualifiedType(rhptee.getCVRQualifiers()); + QualType destType = Context.getPointerType(destPointee); + ImpCastExprToType(LHS, destType); // add qualifiers if necessary + ImpCastExprToType(RHS, destType); // promote to void* + return destType; + } + if (LHSTy->isObjCObjectPointerType() && RHSTy->isVoidPointerType()) { + QualType lhptee = LHSTy->getAsObjCObjectPointerType()->getPointeeType(); + QualType rhptee = RHSTy->getAsPointerType()->getPointeeType(); + QualType destPointee = rhptee.getQualifiedType(lhptee.getCVRQualifiers()); + QualType destType = Context.getPointerType(destPointee); + ImpCastExprToType(RHS, destType); // add qualifiers if necessary + ImpCastExprToType(LHS, destType); // promote to void* + return destType; + } // Check constraints for C object pointers types (C99 6.5.15p3,6). if (LHSTy->isPointerType() && RHSTy->isPointerType()) { // get the "pointed to" types |

