aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-08 20:07:03 +0000
committerChris Lattner <sabre@nondot.org>2005-01-08 20:07:03 +0000
commita8101c163dfb7a8c63f5ac74e878538245802fa4 (patch)
treec6141104d908390d3a073eda446912cffed85f12
parentd564496b46bb5bd0515f545999c7ad0301a2e43c (diff)
Silence VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19390 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/Lexer.l12
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp3
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp2
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l
index e39d224f0c..2edc50fa10 100644
--- a/lib/AsmParser/Lexer.l
+++ b/lib/AsmParser/Lexer.l
@@ -107,7 +107,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
for (char *BIn = Buffer; *BIn; ) {
if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
- *BOut = strtol(BIn+1, 0, 16); // Convert to number
+ *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
if (!AllowNull && !*BOut)
ThrowException("String literal cannot accept \\00 escape!");
@@ -302,13 +302,19 @@ getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
}
-{EPInteger} { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; }
+{EPInteger} {
+ uint64_t Val = atoull(yytext+1);
+ if ((unsigned)Val != Val)
+ ThrowException("Invalid value number (too large)!");
+ llvmAsmlval.UIntVal = unsigned(Val);
+ return UINTVAL;
+ }
{ENInteger} {
uint64_t Val = atoull(yytext+2);
// +1: we have bigger negative range
if (Val > (uint64_t)INT32_MAX+1)
ThrowException("Constant too large for signed 32 bits!");
- llvmAsmlval.SIntVal = -Val;
+ llvmAsmlval.SIntVal = (int)-Val;
return SINTVAL;
}
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 2bab9e735b..1d781d6e4e 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -284,7 +284,8 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
// If the global hasn't been emitted to memory yet, allocate space. We will
// actually initialize the global after current function has finished
// compilation.
- Ptr =new char[getTargetData().getTypeSize(GV->getType()->getElementType())];
+ uint64_t S = getTargetData().getTypeSize(GV->getType()->getElementType());
+ Ptr = new char[(size_t)S];
PendingGlobals.push_back(GV);
}
addGlobalMapping(GV, Ptr);
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 6603433015..bd00c964cc 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -360,7 +360,7 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
unsigned TotalSize = 0;
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
const Type *Ty = Constants[i]->getType();
- unsigned Size = TheJIT->getTargetData().getTypeSize(Ty);
+ unsigned Size = (unsigned)TheJIT->getTargetData().getTypeSize(Ty);
unsigned Alignment = TheJIT->getTargetData().getTypeAlignment(Ty);
// Make sure to take into account the alignment requirements of the type.
TotalSize = (TotalSize + Alignment-1) & ~(Alignment-1);