LEFT | RIGHT |
1 //===--- SemaExpr.cpp - Semantic Analysis for Expressions -----------------===// | 1 //===--- SemaExpr.cpp - Semantic Analysis for Expressions -----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements semantic analysis for expressions. | 10 // This file implements semantic analysis for expressions. |
(...skipping 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4681 if (checkPointerIntegerMismatch(*this, LHS, RHS.get(), QuestionLoc, | 4681 if (checkPointerIntegerMismatch(*this, LHS, RHS.get(), QuestionLoc, |
4682 /*isIntFirstExpr=*/true)) | 4682 /*isIntFirstExpr=*/true)) |
4683 return RHSTy; | 4683 return RHSTy; |
4684 if (checkPointerIntegerMismatch(*this, RHS, LHS.get(), QuestionLoc, | 4684 if (checkPointerIntegerMismatch(*this, RHS, LHS.get(), QuestionLoc, |
4685 /*isIntFirstExpr=*/false)) | 4685 /*isIntFirstExpr=*/false)) |
4686 return LHSTy; | 4686 return LHSTy; |
4687 | 4687 |
4688 // Emit a better diagnostic if one of the expressions is a null pointer | 4688 // Emit a better diagnostic if one of the expressions is a null pointer |
4689 // constant and the other is not a pointer type. In this case, the user most | 4689 // constant and the other is not a pointer type. In this case, the user most |
4690 // likely forgot to take the address of the other expression. | 4690 // likely forgot to take the address of the other expression. |
4691 if (!DiagnoseConditionalForNull(LHS.get(), RHS.get(), QuestionLoc)) | 4691 if (DiagnoseConditionalForNull(LHS.get(), RHS.get(), QuestionLoc)) |
4692 return QualType(); | 4692 return QualType(); |
4693 | 4693 |
4694 // Otherwise, the operands are not compatible. | 4694 // Otherwise, the operands are not compatible. |
4695 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands) | 4695 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands) |
4696 << LHSTy << RHSTy << LHS.get()->getSourceRange() | 4696 << LHSTy << RHSTy << LHS.get()->getSourceRange() |
4697 << RHS.get()->getSourceRange(); | 4697 << RHS.get()->getSourceRange(); |
4698 return QualType(); | 4698 return QualType(); |
4699 } | 4699 } |
4700 | 4700 |
4701 /// FindCompositeObjCPointerType - Helper method to find composite type of | 4701 /// FindCompositeObjCPointerType - Helper method to find composite type of |
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9967 return Owned(E); | 9967 return Owned(E); |
9968 } | 9968 } |
9969 | 9969 |
9970 bool Sema::CheckCaseExpression(Expr *expr) { | 9970 bool Sema::CheckCaseExpression(Expr *expr) { |
9971 if (expr->isTypeDependent()) | 9971 if (expr->isTypeDependent()) |
9972 return true; | 9972 return true; |
9973 if (expr->isValueDependent() || expr->isIntegerConstantExpr(Context)) | 9973 if (expr->isValueDependent() || expr->isIntegerConstantExpr(Context)) |
9974 return expr->getType()->isIntegralOrEnumerationType(); | 9974 return expr->getType()->isIntegralOrEnumerationType(); |
9975 return false; | 9975 return false; |
9976 } | 9976 } |
LEFT | RIGHT |