]> granicus.if.org Git - clang/commitdiff
eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
authorChris Lattner <sabre@nondot.org>
Tue, 4 Sep 2007 02:34:27 +0000 (02:34 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 4 Sep 2007 02:34:27 +0000 (02:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41692 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGExprScalar.cpp
CodeGen/CodeGenFunction.cpp
CodeGen/CodeGenModule.cpp
CodeGen/CodeGenTypes.cpp

index 1cc33bdf18f89bca1c1659490dc935cc255f3c96..e0a871831e7b815f58daf560a94ef963a0789c1b 100644 (file)
@@ -517,7 +517,7 @@ Value *ScalarExprEmitter::EmitSizeAlignOf(QualType TypeToSize,
   
   assert(RetType->isIntegerType() && "Result type must be an integer!");
   
-  unsigned ResultWidth = CGF.getContext().getTypeSize(RetType,SourceLocation());
+  unsigned ResultWidth = static_cast<unsigned>(CGF.getContext().getTypeSize(RetType,SourceLocation()));
   return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val));
 }
 
index 389bd05a70d9dc8ce6d1490084879dd8b16d26f5..d540ea7aa8005fcb56131af26c5d49872fe2d5b9 100644 (file)
@@ -51,9 +51,9 @@ bool CodeGenFunction::hasAggregateLLVMType(QualType T) {
 
 void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
   LLVMIntTy = ConvertType(getContext().IntTy);
-  LLVMPointerWidth =
+  LLVMPointerWidth = static_cast<unsigned>(
     getContext().getTypeSize(getContext().getPointerType(getContext().VoidTy),
-                             SourceLocation());
+                             SourceLocation()));
   
   CurFn = cast<llvm::Function>(CGM.GetAddrOfGlobalDecl(FD));
   CurFuncDecl = FD;
index ec3d0affae5def756279c0493eef578fc80b3f7a..a26e12933621092115d2ff11fc66089a0c9cfbd1 100644 (file)
@@ -67,8 +67,8 @@ void CodeGenModule::EmitGlobalVar(const FileVarDecl *D) {
   if (D->getInit() == 0) {
     Init = llvm::Constant::getNullValue(GV->getType()->getElementType());
   } else if (D->getType()->isIntegerType()) {
-    llvm::APSInt Value(getContext().getTypeSize(D->getInit()->getType(),
-                                                SourceLocation()));
+    llvm::APSInt Value(static_cast<unsigned>(
+      getContext().getTypeSize(D->getInit()->getType(), SourceLocation())));
     if (D->getInit()->isIntegerConstantExpr(Value, Context))
       Init = llvm::ConstantInt::get(Value);
   }
index 85d55844b4ed0537fb8b32ce15b3ab4c70b82afc..46668e45d8eb3adb94da23eed9e8ccaf9a3bcc36 100644 (file)
@@ -58,7 +58,8 @@ const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
     case BuiltinType::ULong:
     case BuiltinType::LongLong:
     case BuiltinType::ULongLong:
-      return llvm::IntegerType::get(Context.getTypeSize(T, SourceLocation()));
+      return llvm::IntegerType::get(
+        static_cast<unsigned>(Context.getTypeSize(T, SourceLocation())));
       
     case BuiltinType::Float:      return llvm::Type::FloatTy;
     case BuiltinType::Double:     return llvm::Type::DoubleTy;