diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-10-14 22:18:38 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-10-14 22:18:38 +0000 |
| commit | 8afa98916ab7bbf2a789a0f7f5c0591d43fd25b3 (patch) | |
| tree | 49cabc587557a2ba2118fb69b2eca712809d4e2a /clang/lib/Sema/SemaExpr.cpp | |
| parent | 28106756affdd568e058bb45a1009e01f6ed81e3 (diff) | |
| download | bcm5719-llvm-8afa98916ab7bbf2a789a0f7f5c0591d43fd25b3.tar.gz bcm5719-llvm-8afa98916ab7bbf2a789a0f7f5c0591d43fd25b3.zip | |
Downgrade incompatibilities with objc qualified types (e.g. id <P>) to warnings.
Note: One day, we should consider moving the actual diags to ObjCQualifiedIdTypesAreCompatible(), since it has more information on the actual problem. GCC currently emits slightly more instructive errors for some cases involving protocols. I added a FIXME to the code.
llvm-svn: 57529
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a6197dd2b75..c8610da6bd9 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1587,7 +1587,7 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { return IntToPointer; if (lhsType->isIntegerType()) return PointerToInt; - return Incompatible; + return IncompatibleObjCQualifiedId; } if (lhsType->isVectorType() || rhsType->isVectorType()) { @@ -2034,6 +2034,13 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation loc, if (ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) { ImpCastExprToType(rex, lType); return Context.IntTy; + } else { + if ((lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType())) { + Diag(loc, diag::warn_incompatible_qualified_id_operands, + lex->getType().getAsString(), rex->getType().getAsString(), + lex->getSourceRange(), rex->getSourceRange()); + return QualType(); + } } } if ((lType->isPointerType() || lType->isObjCQualifiedIdType()) && @@ -3078,6 +3085,11 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, case BlockVoidPointer: DiagKind = diag::ext_typecheck_convert_pointer_void_block; break; + case IncompatibleObjCQualifiedId: + // FIXME: Diagnose the problem in ObjCQualifiedIdTypesAreCompatible, since + // it can give a more specific diagnostic. + DiagKind = diag::warn_incompatible_qualified_id; + break; case Incompatible: DiagKind = diag::err_typecheck_convert_incompatible; isInvalid = true; |

