Skip to content

Commit

Permalink
Explicitly cast narrowing conversions inside {}s that will become err…
Browse files Browse the repository at this point in the history
…ors in

C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136211 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jyasskin committed Jul 27, 2011
1 parent cbdccde commit a44defe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/Analysis/BasicAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
}

if (Scale) {
VariableGEPIndex Entry = {Index, Extension, Scale};
VariableGEPIndex Entry = {Index, Extension,
static_cast<int64_t>(Scale)};
VarIndices.push_back(Entry);
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,8 @@ void SelectionDAGBuilder::visitShuffleVector(const User &I) {
// Analyze the access pattern of the vector to see if we can extract
// two subvectors and do the shuffle. The analysis is done by calculating
// the range of elements the mask access on both vectors.
int MinRange[2] = { SrcNumElts+1, SrcNumElts+1};
int MinRange[2] = { static_cast<int>(SrcNumElts+1),
static_cast<int>(SrcNumElts+1)};
int MaxRange[2] = {-1, -1};

for (unsigned i = 0; i != MaskNumElts; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op,
}

// Calculate what the SS field value should be...
static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
static const unsigned SSTable[] = { ~0U, 0, 1, ~0U, 2, ~0U, ~0U, ~0U, 3 };
unsigned SS = SSTable[Scale.getImm()];

if (BaseReg == 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/X86/X86CodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void Emitter<CodeEmitter>::emitMemModRMByte(const MachineInstr &MI,
}

// Calculate what the SS field value should be...
static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
static const unsigned SSTable[] = { ~0U, 0, 1, ~0U, 2, ~0U, ~0U, ~0U, 3 };
unsigned SS = SSTable[Scale.getImm()];

if (BaseReg == 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6357,7 +6357,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
return Op;

// SHUFPS the element to the lowest double word, then movss.
int Mask[4] = { Idx, -1, -1, -1 };
int Mask[4] = { static_cast<int>(Idx), -1, -1, -1 };
EVT VVT = Op.getOperand(0).getValueType();
SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0),
DAG.getUNDEF(VVT), Mask);
Expand Down
2 changes: 1 addition & 1 deletion unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct RecordingJITEventListener : public JITEventListener {
std::vector<FunctionEmittedEvent> EmittedEvents;
std::vector<FunctionFreedEvent> FreedEvents;

int NextIndex;
unsigned NextIndex;

RecordingJITEventListener() : NextIndex(0) {}

Expand Down

0 comments on commit a44defe

Please sign in to comment.