| OLD | NEW |
| 1 //===--- SemaChecking.cpp - Extra Semantic Checking -----------------------===// | 1 //===--- SemaChecking.cpp - Extra Semantic Checking -----------------------===// |
| 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 extra semantic analysis beyond what is enforced | 10 // This file implements extra semantic analysis beyond what is enforced |
| (...skipping 6034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6045 Expr *Constant, Expr *Other, | 6045 Expr *Constant, Expr *Other, |
| 6046 llvm::APSInt Value, | 6046 llvm::APSInt Value, |
| 6047 bool RhsConstant) { | 6047 bool RhsConstant) { |
| 6048 // Disable warning in template instantiations. | 6048 // Disable warning in template instantiations. |
| 6049 if (!S.ActiveTemplateInstantiations.empty()) | 6049 if (!S.ActiveTemplateInstantiations.empty()) |
| 6050 return; | 6050 return; |
| 6051 | 6051 |
| 6052 // TODO: Investigate using GetExprRange() to get tighter bounds | 6052 // TODO: Investigate using GetExprRange() to get tighter bounds |
| 6053 // on the bit ranges. | 6053 // on the bit ranges. |
| 6054 QualType OtherT = Other->getType(); | 6054 QualType OtherT = Other->getType(); |
| 6055 if (const AtomicType *AT = dyn_cast<AtomicType>(OtherT)) | 6055 if (const auto *AT = OtherT->getAs<AtomicType>()) |
| 6056 OtherT = AT->getValueType(); | 6056 OtherT = AT->getValueType(); |
| 6057 IntRange OtherRange = IntRange::forValueOfType(S.Context, OtherT); | 6057 IntRange OtherRange = IntRange::forValueOfType(S.Context, OtherT); |
| 6058 unsigned OtherWidth = OtherRange.Width; | 6058 unsigned OtherWidth = OtherRange.Width; |
| 6059 | 6059 |
| 6060 bool OtherIsBooleanType = Other->isKnownToHaveBooleanValue(); | 6060 bool OtherIsBooleanType = Other->isKnownToHaveBooleanValue(); |
| 6061 | 6061 |
| 6062 // 0 values are handled later by CheckTrivialUnsignedComparison(). | 6062 // 0 values are handled later by CheckTrivialUnsignedComparison(). |
| 6063 if ((Value == 0) && (!OtherIsBooleanType)) | 6063 if ((Value == 0) && (!OtherIsBooleanType)) |
| 6064 return; | 6064 return; |
| 6065 | 6065 |
| (...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9318 mismatch = !isLayoutCompatible(Context, ArgumentType, RequiredType); | 9318 mismatch = !isLayoutCompatible(Context, ArgumentType, RequiredType); |
| 9319 | 9319 |
| 9320 if (mismatch) | 9320 if (mismatch) |
| 9321 Diag(ArgumentExpr->getExprLoc(), diag::warn_type_safety_type_mismatch) | 9321 Diag(ArgumentExpr->getExprLoc(), diag::warn_type_safety_type_mismatch) |
| 9322 << ArgumentType << ArgumentKind | 9322 << ArgumentType << ArgumentKind |
| 9323 << TypeInfo.LayoutCompatible << RequiredType | 9323 << TypeInfo.LayoutCompatible << RequiredType |
| 9324 << ArgumentExpr->getSourceRange() | 9324 << ArgumentExpr->getSourceRange() |
| 9325 << TypeTagExpr->getSourceRange(); | 9325 << TypeTagExpr->getSourceRange(); |
| 9326 } | 9326 } |
| 9327 | 9327 |
| OLD | NEW |