From ec646834e7bb008ee3f58d4fe1445ac64f0382c2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 7 Apr 2008 06:49:41 +0000 Subject: simplify compatibility testing for tag types. llvm-svn: 49323 --- clang/lib/Sema/SemaExpr.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'clang/lib/Sema') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a528519d265..f0f05006f37 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1167,7 +1167,6 @@ Sema::CheckPointerTypesForAssignment(QualType lhsType, QualType rhsType) { /// /// As a result, the code for dealing with pointers is more complex than the /// C99 spec dictates. -/// Note: the warning above turn into errors when -pedantic-errors is enabled. /// Sema::AssignConvertType Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { @@ -1191,9 +1190,9 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { return Incompatible; } - if (lhsType->isVectorType() || rhsType->isVectorType()) { + if (isa(lhsType) || isa(rhsType)) { // For OCUVector, allow vector splats; float -> - if (const OCUVectorType *LV = lhsType->getAsOCUVectorType()) { + if (const OCUVectorType *LV = dyn_cast(lhsType)) { if (LV->getElementType().getTypePtr() == rhsType.getTypePtr()) return Compatible; } @@ -1216,27 +1215,27 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { if (lhsType->isArithmeticType() && rhsType->isArithmeticType()) return Compatible; - if (lhsType->isPointerType()) { + if (isa(lhsType)) { if (rhsType->isIntegerType()) return IntToPointer; - if (rhsType->isPointerType()) + if (isa(rhsType)) return CheckPointerTypesForAssignment(lhsType, rhsType); return Incompatible; } - if (rhsType->isPointerType()) { + if (isa(rhsType)) { // C99 6.5.16.1p1: the left operand is _Bool and the right is a pointer. - if ((lhsType->isIntegerType()) && (lhsType != Context.BoolTy)) + if (lhsType->isIntegerType() && lhsType != Context.BoolTy) return PointerToInt; - if (lhsType->isPointerType()) + if (isa(lhsType)) return CheckPointerTypesForAssignment(lhsType, rhsType); return Incompatible; } if (isa(lhsType) && isa(rhsType)) { - if (Context.tagTypesAreCompatible(lhsType, rhsType)) + if (Context.typesAreCompatible(lhsType, rhsType)) return Compatible; } return Incompatible; -- cgit v1.2.3