[cfe-commits] r41693 - in /cfe/trunk: AST/Expr.cpp Lex/PPExpressions.cpp Sema/Sema.h Sema/SemaDecl.cpp Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Mon Sep 3 19:45:27 PDT 2007
Author: lattner
Date: Mon Sep 3 21:45:27 2007
New Revision: 41693
URL: http://llvm.org/viewvc/llvm-project?rev=41693&view=rev
Log:
Silence VC++ warnings, patch by Hartmut Kaiser
Modified:
cfe/trunk/AST/Expr.cpp
cfe/trunk/Lex/PPExpressions.cpp
cfe/trunk/Sema/Sema.h
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=41693&r1=41692&r2=41693&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Mon Sep 3 21:45:27 2007
@@ -499,20 +499,23 @@
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();
@@ -550,7 +553,8 @@
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)
@@ -562,7 +566,8 @@
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;
}
@@ -584,7 +589,8 @@
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())
@@ -647,10 +653,12 @@
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;
@@ -711,7 +719,8 @@
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())
Modified: cfe/trunk/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/PPExpressions.cpp?rev=41693&r1=41692&r2=41693&view=diff
==============================================================================
--- cfe/trunk/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/Lex/PPExpressions.cpp Mon Sep 3 21:45:27 2007
@@ -475,7 +475,7 @@
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())
@@ -490,7 +490,7 @@
}
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;
Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=41693&r1=41692&r2=41693&view=diff
==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Mon Sep 3 21:45:27 2007
@@ -36,8 +36,8 @@
class TypedefDecl;
class FunctionDecl;
class QualType;
- class LangOptions;
- class DeclaratorChunk;
+ struct LangOptions;
+ struct DeclaratorChunk;
class Token;
class IntegerLiteral;
class ArrayType;
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=41693&r1=41692&r2=41693&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Sep 3 21:45:27 2007
@@ -1190,7 +1190,8 @@
} 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)));
}
}
@@ -1420,7 +1421,7 @@
}
// 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,
@@ -1473,9 +1474,10 @@
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) {
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=41693&r1=41692&r2=41693&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Sep 3 21:45:27 2007
@@ -129,7 +129,8 @@
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()));
@@ -181,7 +182,8 @@
// 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?
@@ -197,8 +199,8 @@
// 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)) {
@@ -214,8 +216,8 @@
// 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)) {
More information about the cfe-commits
mailing list