Chromium Code Reviews| Index: src/PNaClTranslator.cpp |
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
| index 0f4feacafe5d2768bd8edae99a2ab2f6c5a65087..f7f0386129bbcd061a7b13619471cf46bc1fc83b 100644 |
| --- a/src/PNaClTranslator.cpp |
| +++ b/src/PNaClTranslator.cpp |
| @@ -325,8 +325,8 @@ public: |
| SuppressMangling = false; |
| } |
| const Ice::RelocOffsetT Offset = 0; |
| - C = getTranslator().getContext()->getConstantSym( |
| - getIcePointerType(), Offset, Name, SuppressMangling); |
| + C = getTranslator().getContext()->getConstantSym(Offset, Name, |
| + SuppressMangling); |
| ValueIDConstants[ID] = C; |
| return C; |
| } |
| @@ -1440,7 +1440,7 @@ private: |
| const auto *C = dyn_cast<Ice::ConstantInteger32>(Index); |
| if (C == nullptr) |
| return VectorIndexNotConstant; |
| - if (C->getValue() >= typeNumElements(VecType)) |
| + if (static_cast<size_t>(C->getValue()) >= typeNumElements(VecType)) |
| return VectorIndexNotInRange; |
| if (Index->getType() != Ice::IceType_i32) |
| return VectorIndexNotI32; |
| @@ -2499,13 +2499,12 @@ void ConstantsParser::ProcessRecord() { |
| if (IntegerType *IType = dyn_cast<IntegerType>( |
| Context->convertToLLVMType(NextConstantType))) { |
| APInt Value(IType->getBitWidth(), NaClDecodeSignRotatedValue(Values[0])); |
| - Ice::Constant *C = (NextConstantType == Ice::IceType_i64) |
| - ? getContext()->getConstantInt64( |
| - NextConstantType, Value.getSExtValue()) |
| - : getContext()->getConstantInt32( |
| - NextConstantType, Value.getSExtValue()); |
| - FuncParser->setNextConstantID(C); |
| - return; |
| + Ice::Constant *C = nullptr; |
|
Karl
2014/11/20 17:43:39
Why not:
if (auto C = getContext->getConstantInt(
Jim Stichnoth
2014/11/20 19:04:58
Good point, done.
|
| + C = getContext()->getConstantInt(NextConstantType, Value.getSExtValue()); |
| + if (C) { |
| + FuncParser->setNextConstantID(C); |
| + return; |
| + } |
| } |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |