break;
case CharacterLiteralClass: {
const CharacterLiteral *CL = cast<CharacterLiteral>(this);
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), CL->getLoc()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), CL->getLoc())));
Result = CL->getValue();
Result.setIsUnsigned(!getType()->isSignedIntegerType());
break;
}
case TypesCompatibleExprClass: {
const TypesCompatibleExpr *TCE = cast<TypesCompatibleExpr>(this);
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), TCE->getLocStart()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), TCE->getLocStart())));
Result = TCE->typesAreCompatible();
break;
}
case CallExprClass: {
const CallExpr *CE = cast<CallExpr>(this);
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), CE->getLocStart()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), CE->getLocStart())));
if (CE->isBuiltinClassifyType(Result))
break;
if (Loc) *Loc = getLocStart();
return false;
// Return the result in the right width.
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), Exp->getOperatorLoc()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), Exp->getOperatorLoc())));
// Get information about the size or align.
if (Exp->getOpcode() == UnaryOperator::SizeOf)
break;
case UnaryOperator::LNot: {
bool Val = Result != 0;
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), Exp->getOperatorLoc()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), Exp->getOperatorLoc())));
Result = Val;
break;
}
return false;
// Return the result in the right width.
- Result.zextOrTrunc(Ctx.getTypeSize(getType(), Exp->getOperatorLoc()));
+ Result.zextOrTrunc(
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), Exp->getOperatorLoc())));
// Get information about the size or align.
if (Exp->isSizeOf())
case BinaryOperator::Add: Result += RHS; break;
case BinaryOperator::Sub: Result -= RHS; break;
case BinaryOperator::Shl:
- Result <<= RHS.getLimitedValue(Result.getBitWidth()-1);
+ Result <<=
+ static_cast<uint32_t>(RHS.getLimitedValue(Result.getBitWidth()-1));
break;
case BinaryOperator::Shr:
- Result >>= RHS.getLimitedValue(Result.getBitWidth()-1);
+ Result >>=
+ static_cast<uint32_t>(RHS.getLimitedValue(Result.getBitWidth()-1));
break;
case BinaryOperator::LT: Result = Result < RHS; break;
case BinaryOperator::GT: Result = Result > RHS; break;
return false;
// Figure out if this is a truncate, extend or noop cast.
- unsigned DestWidth = Ctx.getTypeSize(getType(), CastLoc);
+ unsigned DestWidth =
+ static_cast<uint32_t>(Ctx.getTypeSize(getType(), CastLoc));
// If the input is signed, do a sign extend, noop, or truncate.
if (SubExpr->getType()->isSignedIntegerType())
break;
case tok::lessless: {
// Determine whether overflow is about to happen.
- unsigned ShAmt = RHS.getLimitedValue();
+ unsigned ShAmt = static_cast<unsigned>(RHS.getLimitedValue());
if (ShAmt >= LHS.getBitWidth())
Overflow = true, ShAmt = LHS.getBitWidth()-1;
else if (LHS.isUnsigned())
}
case tok::greatergreater: {
// Determine whether overflow is about to happen.
- unsigned ShAmt = RHS.getLimitedValue();
+ unsigned ShAmt = static_cast<unsigned>(RHS.getLimitedValue());
if (ShAmt >= LHS.getBitWidth())
Overflow = true, ShAmt = LHS.getBitWidth()-1;
Res = LHS >> ShAmt;
class TypedefDecl;
class FunctionDecl;
class QualType;
- class LangOptions;
- class DeclaratorChunk;
+ struct LangOptions;
+ struct DeclaratorChunk;
class Token;
class IntegerLiteral;
class ArrayType;
} else {
// First value, set to zero.
EltTy = Context.IntTy;
- EnumVal.zextOrTrunc(Context.getTypeSize(EltTy, IdLoc));
+ EnumVal.zextOrTrunc(
+ static_cast<uint32_t>(Context.getTypeSize(EltTy, IdLoc)));
}
}
}
// unlike gcc's vector_size attribute, the size is specified as the
// number of elements, not the number of bytes.
- unsigned vectorSize = vecSize.getZExtValue();
+ unsigned vectorSize = static_cast<unsigned>(vecSize.getZExtValue());
if (vectorSize == 0) {
Diag(rawAttr->getAttributeLoc(), diag::err_attribute_zero_size,
curType.getCanonicalType().getAsString());
return QualType();
}
- unsigned typeSize = Context.getTypeSize(curType, rawAttr->getAttributeLoc());
+ unsigned typeSize = static_cast<unsigned>(
+ Context.getTypeSize(curType, rawAttr->getAttributeLoc()));
// vecSize is specified in bytes - convert to bits.
- unsigned vectorSize = vecSize.getZExtValue() * 8;
+ unsigned vectorSize = static_cast<unsigned>(vecSize.getZExtValue() * 8);
// the vector size needs to be an integral multiple of the type size.
if (vectorSize % typeSize) {
if (Tok.getLength() == 1) {
const char *t = PP.getSourceManager().getCharacterData(Tok.getLocation());
- unsigned IntSize = Context.getTypeSize(Context.IntTy, Tok.getLocation());
+ unsigned IntSize = static_cast<unsigned>(
+ Context.getTypeSize(Context.IntTy, Tok.getLocation()));
return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, *t-'0'),
Context.IntTy,
Tok.getLocation()));
// Check from smallest to largest, picking the smallest type we can.
if (!Literal.isLong && !Literal.isLongLong) {
// Are int/unsigned possibilities?
- unsigned IntSize = Context.getTypeSize(Context.IntTy,Tok.getLocation());
+ unsigned IntSize = static_cast<unsigned>(
+ Context.getTypeSize(Context.IntTy,Tok.getLocation()));
// Does it fit in a unsigned int?
if (ResultVal.isIntN(IntSize)) {
// Does it fit in a signed int?
// Are long/unsigned long possibilities?
if (t.isNull() && !Literal.isLongLong) {
- unsigned LongSize = Context.getTypeSize(Context.LongTy,
- Tok.getLocation());
+ unsigned LongSize = static_cast<unsigned>(
+ Context.getTypeSize(Context.LongTy, Tok.getLocation()));
// Does it fit in a unsigned long?
if (ResultVal.isIntN(LongSize)) {
// Finally, check long long if needed.
if (t.isNull()) {
- unsigned LongLongSize =
- Context.getTypeSize(Context.LongLongTy, Tok.getLocation());
+ unsigned LongLongSize = static_cast<unsigned>(
+ Context.getTypeSize(Context.LongLongTy, Tok.getLocation()));
// Does it fit in a unsigned long long?
if (ResultVal.isIntN(LongLongSize)) {