[llvm-commits] [llvm] r50659 - in /llvm/trunk: include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/Debugger/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ lib/Support/ lib/System/ lib/System/Unix/
Evan Cheng
evan.cheng at apple.com
Mon May 5 11:30:59 PDT 2008
Author: evancheng
Date: Mon May 5 13:30:58 2008
New Revision: 50659
URL: http://llvm.org/viewvc/llvm-project?rev=50659&view=rev
Log:
Fix more -Wshorten-64-to-32 warnings.
Modified:
llvm/trunk/include/llvm/ADT/BitVector.h
llvm/trunk/include/llvm/ADT/SmallPtrSet.h
llvm/trunk/include/llvm/ADT/SmallVector.h
llvm/trunk/include/llvm/ADT/StringExtras.h
llvm/trunk/include/llvm/ADT/StringMap.h
llvm/trunk/include/llvm/ADT/UniqueVector.h
llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/include/llvm/Analysis/DominatorInternals.h
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/trunk/include/llvm/Bitcode/Archive.h
llvm/trunk/include/llvm/Bitcode/BitCodes.h
llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
llvm/trunk/include/llvm/CodeGen/LiveInterval.h
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/include/llvm/CodeGen/MachineInstr.h
llvm/trunk/include/llvm/CodeGen/MachineJumpTableInfo.h
llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/trunk/include/llvm/Debugger/Debugger.h
llvm/trunk/include/llvm/Debugger/SourceFile.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/ParameterAttributes.h
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/include/llvm/Support/AlignOf.h
llvm/trunk/include/llvm/Support/Allocator.h
llvm/trunk/include/llvm/Support/CommandLine.h
llvm/trunk/include/llvm/Support/GraphWriter.h
llvm/trunk/include/llvm/Support/MemoryBuffer.h
llvm/trunk/include/llvm/Support/OutputBuffer.h
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
llvm/trunk/include/llvm/User.h
llvm/trunk/lib/Support/Allocator.cpp
llvm/trunk/lib/Support/CommandLine.cpp
llvm/trunk/lib/Support/FileUtilities.cpp
llvm/trunk/lib/Support/FoldingSet.cpp
llvm/trunk/lib/Support/MemoryBuffer.cpp
llvm/trunk/lib/Support/Statistic.cpp
llvm/trunk/lib/Support/StringExtras.cpp
llvm/trunk/lib/System/Path.cpp
llvm/trunk/lib/System/Unix/Memory.inc
llvm/trunk/lib/System/Unix/Path.inc
llvm/trunk/lib/System/Unix/Program.inc
llvm/trunk/lib/System/Unix/Signals.inc
Modified: llvm/trunk/include/llvm/ADT/BitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/BitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/BitVector.h Mon May 5 13:30:58 2008
@@ -25,7 +25,7 @@
class BitVector {
typedef unsigned long BitWord;
- enum { BITWORD_SIZE = sizeof(BitWord) * 8 };
+ enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * 8 };
BitWord *Bits; // Actual bits.
unsigned Size; // Size of bitvector in bits.
@@ -103,7 +103,7 @@
unsigned NumBits = 0;
for (unsigned i = 0; i < NumBitWords(size()); ++i)
if (sizeof(BitWord) == 4)
- NumBits += CountPopulation_32(Bits[i]);
+ NumBits += CountPopulation_32((uint32_t)Bits[i]);
else if (sizeof(BitWord) == 8)
NumBits += CountPopulation_64(Bits[i]);
else
@@ -130,7 +130,7 @@
for (unsigned i = 0; i < NumBitWords(size()); ++i)
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
- return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
+ return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
else if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
else
@@ -154,7 +154,7 @@
if (Copy != 0) {
if (sizeof(BitWord) == 4)
- return WordPos * BITWORD_SIZE + CountTrailingZeros_32(Copy);
+ return WordPos * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Copy);
else if (sizeof(BitWord) == 8)
return WordPos * BITWORD_SIZE + CountTrailingZeros_64(Copy);
else
@@ -165,7 +165,7 @@
for (unsigned i = WordPos+1; i < NumBitWords(size()); ++i)
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
- return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
+ return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
else if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
else
Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Mon May 5 13:30:58 2008
@@ -121,7 +121,7 @@
bool isSmall() const { return CurArray == &SmallArray[0]; }
unsigned Hash(const void *Ptr) const {
- return ((uintptr_t)Ptr >> 4) & (CurArraySize-1);
+ return static_cast<unsigned>(((uintptr_t)Ptr >> 4) & (CurArraySize-1));
}
const void * const *FindBucketFor(const void *Ptr) const;
void shrink_and_clear();
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon May 5 13:30:58 2008
@@ -190,7 +190,7 @@
///
template<typename in_iter>
void append(in_iter in_start, in_iter in_end) {
- unsigned NumInputs = std::distance(in_start, in_end);
+ size_type NumInputs = std::distance(in_start, in_end);
// Grow allocated space if needed.
if (End+NumInputs > Capacity)
grow(size()+NumInputs);
@@ -242,7 +242,7 @@
*I = Elt;
return I;
}
- unsigned EltNo = I-Begin;
+ size_t EltNo = I-Begin;
grow();
I = Begin+EltNo;
goto Retry;
@@ -255,12 +255,12 @@
return end()-1;
}
- unsigned NumToInsert = std::distance(From, To);
+ size_t NumToInsert = std::distance(From, To);
// Convert iterator to elt# to avoid invalidating iterator when we reserve()
- unsigned InsertElt = I-begin();
+ size_t InsertElt = I-begin();
// Ensure there is enough space.
- reserve(size() + NumToInsert);
+ reserve(static_cast<unsigned>(size() + NumToInsert));
// Uninvalidate the iterator.
I = begin()+InsertElt;
@@ -285,7 +285,7 @@
// Copy over the elements that we're about to overwrite.
T *OldEnd = End;
End += NumToInsert;
- unsigned NumOverwritten = OldEnd-I;
+ size_t NumOverwritten = OldEnd-I;
std::uninitialized_copy(I, OldEnd, End-NumOverwritten);
// Replace the overwritten part.
@@ -318,7 +318,7 @@
/// grow - double the size of the allocated memory, guaranteeing space for at
/// least one more element or MinSize if specified.
- void grow(unsigned MinSize = 0);
+ void grow(size_type MinSize = 0);
void construct_range(T *S, T *E, const T &Elt) {
for (; S != E; ++S)
@@ -335,10 +335,10 @@
// Define this out-of-line to dissuade the C++ compiler from inlining it.
template <typename T>
-void SmallVectorImpl<T>::grow(unsigned MinSize) {
- unsigned CurCapacity = unsigned(Capacity-Begin);
- unsigned CurSize = unsigned(size());
- unsigned NewCapacity = 2*CurCapacity;
+void SmallVectorImpl<T>::grow(size_t MinSize) {
+ size_t CurCapacity = Capacity-Begin;
+ size_t CurSize = size();
+ size_t NewCapacity = 2*CurCapacity;
if (NewCapacity < MinSize)
NewCapacity = MinSize;
T *NewElts = reinterpret_cast<T*>(new char[NewCapacity*sizeof(T)]);
@@ -375,20 +375,20 @@
RHS.grow(size());
// Swap the shared elements.
- unsigned NumShared = size();
+ size_t NumShared = size();
if (NumShared > RHS.size()) NumShared = RHS.size();
- for (unsigned i = 0; i != NumShared; ++i)
+ for (unsigned i = 0; i != static_cast<unsigned>(NumShared); ++i)
std::swap(Begin[i], RHS[i]);
// Copy over the extra elts.
if (size() > RHS.size()) {
- unsigned EltDiff = size() - RHS.size();
+ size_t EltDiff = size() - RHS.size();
std::uninitialized_copy(Begin+NumShared, End, RHS.End);
RHS.End += EltDiff;
destroy_range(Begin+NumShared, End);
End = Begin+NumShared;
} else if (RHS.size() > size()) {
- unsigned EltDiff = RHS.size() - size();
+ size_t EltDiff = RHS.size() - size();
std::uninitialized_copy(RHS.Begin+NumShared, RHS.End, End);
End += EltDiff;
destroy_range(RHS.Begin+NumShared, RHS.End);
@@ -458,7 +458,9 @@
typedef typename SmallVectorImpl<T>::U U;
enum {
// MinUs - The number of U's require to cover N T's.
- MinUs = (sizeof(T)*N+sizeof(U)-1)/sizeof(U),
+ MinUs = (static_cast<unsigned int>(sizeof(T))*N +
+ static_cast<unsigned int>(sizeof(U)) - 1) /
+ static_cast<unsigned int>(sizeof(U)),
// NumInlineEltsElts - The number of elements actually in this array. There
// is already one in the parent class, and we have to round up to avoid
@@ -467,7 +469,8 @@
// NumTsAvailable - The number of T's we actually have space for, which may
// be more than N due to rounding.
- NumTsAvailable = (NumInlineEltsElts+1)*sizeof(U) / sizeof(T)
+ NumTsAvailable = (NumInlineEltsElts+1)*static_cast<unsigned int>(sizeof(U))/
+ static_cast<unsigned int>(sizeof(T))
};
U InlineElts[NumInlineEltsElts];
public:
Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Mon May 5 13:30:58 2008
@@ -126,7 +126,7 @@
static inline bool StringsEqualNoCase(const std::string &LHS,
const std::string &RHS) {
if (LHS.size() != RHS.size()) return false;
- for (unsigned i = 0, e = LHS.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(LHS.size()); i != e; ++i)
if (tolower(LHS[i]) != tolower(RHS[i])) return false;
return true;
}
@@ -135,7 +135,7 @@
/// case.
static inline bool StringsEqualNoCase(const std::string &LHS,
const char *RHS) {
- for (unsigned i = 0, e = LHS.size(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(LHS.size()); i != e; ++i) {
if (RHS[i] == 0) return false; // RHS too short.
if (tolower(LHS[i]) != tolower(RHS[i])) return false;
}
Modified: llvm/trunk/include/llvm/ADT/StringMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)
+++ llvm/trunk/include/llvm/ADT/StringMap.h Mon May 5 13:30:58 2008
@@ -153,13 +153,14 @@
static StringMapEntry *Create(const char *KeyStart, const char *KeyEnd,
AllocatorTy &Allocator,
InitType InitVal) {
- unsigned KeyLength = KeyEnd-KeyStart;
+ unsigned KeyLength = static_cast<unsigned>(KeyEnd-KeyStart);
// Okay, the item doesn't already exist, and 'Bucket' is the bucket to fill
// in. Allocate a new item with space for the string at the end and a null
// terminator.
- unsigned AllocSize = sizeof(StringMapEntry)+KeyLength+1;
+ unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
+ KeyLength+1;
unsigned Alignment = alignof<StringMapEntry>();
StringMapEntry *NewItem =
@@ -236,9 +237,9 @@
AllocatorTy Allocator;
typedef StringMapEntry<ValueTy> MapEntryTy;
public:
- StringMap() : StringMapImpl(sizeof(MapEntryTy)) {}
+ StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {}
explicit StringMap(unsigned InitialSize)
- : StringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
+ : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {}
AllocatorTy &getAllocator() { return Allocator; }
const AllocatorTy &getAllocator() const { return Allocator; }
Modified: llvm/trunk/include/llvm/ADT/UniqueVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/UniqueVector.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/UniqueVector.h (original)
+++ llvm/trunk/include/llvm/ADT/UniqueVector.h Mon May 5 13:30:58 2008
@@ -41,7 +41,7 @@
if (Val) return Val;
// Compute ID for entry.
- Val = Vector.size() + 1;
+ Val = static_cast<unsigned>(Vector.size()) + 1;
// Insert in vector.
Vector.push_back(Entry);
Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Mon May 5 13:30:58 2008
@@ -232,7 +232,7 @@
bool KnownMustAlias = false);
void addCallSite(CallSite CS, AliasAnalysis &AA);
void removeCallSite(CallSite CS) {
- for (unsigned i = 0, e = CallSites.size(); i != e; ++i)
+ for (size_t i = 0, e = CallSites.size(); i != e; ++i)
if (CallSites[i].getInstruction() == CS.getInstruction()) {
CallSites[i] = CallSites.back();
CallSites.pop_back();
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Mon May 5 13:30:58 2008
@@ -191,7 +191,7 @@
inline const_iterator begin() const { return CalledFunctions.begin(); }
inline const_iterator end() const { return CalledFunctions.end(); }
inline bool empty() const { return CalledFunctions.empty(); }
- inline unsigned size() const { return CalledFunctions.size(); }
+ inline unsigned size() const { return (unsigned)CalledFunctions.size(); }
// Subscripting operator - Return the i'th called function...
//
Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Mon May 5 13:30:58 2008
@@ -248,7 +248,8 @@
// Step #1: Number blocks in depth-first order and initialize variables used
// in later stages of the algorithm.
- for (unsigned i = 0, e = DT.Roots.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(DT.Roots.size());
+ i != e; ++i)
N = DFSPass<GraphT>(DT, DT.Roots[i], N);
// it might be that some blocks did not get a DFS number (e.g., blocks of
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon May 5 13:30:58 2008
@@ -237,7 +237,7 @@
bool NewBBDominatesNewBBSucc = true;
{
typename GraphT::NodeType* OnePred = PredBlocks[0];
- unsigned i = 1, e = PredBlocks.size();
+ size_t i = 1, e = PredBlocks.size();
for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) {
assert(i != e && "Didn't find reachable pred?");
OnePred = PredBlocks[i];
@@ -567,7 +567,7 @@
SmallVector<std::pair<DomTreeNodeBase<NodeT>*,
typename DomTreeNodeBase<NodeT>::iterator>, 32> WorkStack;
- for (unsigned i = 0, e = this->Roots.size(); i != e; ++i) {
+ for (unsigned i = 0, e = (unsigned)this->Roots.size(); i != e; ++i) {
DomTreeNodeBase<NodeT> *ThisRoot = getNode(this->Roots[i]);
WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin()));
ThisRoot->DFSNumIn = DFSNum++;
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Mon May 5 13:30:58 2008
@@ -80,7 +80,7 @@
/// Loop ctor - This creates an empty loop.
LoopBase() : ParentLoop(0) {}
~LoopBase() {
- for (unsigned i = 0, e = SubLoops.size(); i != e; ++i)
+ for (size_t i = 0, e = SubLoops.size(); i != e; ++i)
delete SubLoops[i];
}
@@ -847,7 +847,8 @@
"This loop should not be inserted here!");
// Check to see if it belongs in a child loop...
- for (unsigned i = 0, e = Parent->SubLoops.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Parent->SubLoops.size());
+ i != e; ++i)
if (Parent->SubLoops[i]->contains(LHeader)) {
InsertLoopInto(L, Parent->SubLoops[i]);
return;
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Mon May 5 13:30:58 2008
@@ -229,7 +229,7 @@
~SCEVCommutativeExpr();
public:
- unsigned getNumOperands() const { return Operands.size(); }
+ unsigned getNumOperands() const { return (unsigned)Operands.size(); }
const SCEVHandle &getOperand(unsigned i) const {
assert(i < Operands.size() && "Operand index out of range!");
return Operands[i];
@@ -387,7 +387,7 @@
SCEVAddRecExpr(const std::vector<SCEVHandle> &ops, const Loop *l)
: SCEV(scAddRecExpr), Operands(ops), L(l) {
- for (unsigned i = 0, e = Operands.size(); i != e; ++i)
+ for (size_t i = 0, e = Operands.size(); i != e; ++i)
assert(Operands[i]->isLoopInvariant(l) &&
"Operands of AddRec must be loop-invariant!");
}
@@ -397,7 +397,7 @@
op_iterator op_begin() const { return Operands.begin(); }
op_iterator op_end() const { return Operands.end(); }
- unsigned getNumOperands() const { return Operands.size(); }
+ unsigned getNumOperands() const { return (unsigned)Operands.size(); }
const SCEVHandle &getOperand(unsigned i) const { return Operands[i]; }
const SCEVHandle &getStart() const { return Operands[0]; }
const Loop *getLoop() const { return L; }
Modified: llvm/trunk/include/llvm/Bitcode/Archive.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Archive.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Archive.h Mon May 5 13:30:58 2008
@@ -254,7 +254,7 @@
inline reverse_iterator rend () { return members.rend(); }
inline const_reverse_iterator rend () const { return members.rend(); }
- inline unsigned size() const { return members.size(); }
+ inline size_t size() const { return members.size(); }
inline bool empty() const { return members.empty(); }
inline const ArchiveMember& front() const { return members.front(); }
inline ArchiveMember& front() { return members.front(); }
Modified: llvm/trunk/include/llvm/Bitcode/BitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitCodes.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitCodes.h Mon May 5 13:30:58 2008
@@ -165,7 +165,9 @@
void addRef() { ++RefCount; }
void dropRef() { if (--RefCount == 0) delete this; }
- unsigned getNumOperandInfos() const { return OperandList.size(); }
+ unsigned getNumOperandInfos() const {
+ return static_cast<unsigned>(OperandList.size());
+ }
const BitCodeAbbrevOp &getOperandInfo(unsigned N) const {
return OperandList[N];
}
Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Mon May 5 13:30:58 2008
@@ -85,12 +85,15 @@
~BitstreamReader() {
// Abbrevs could still exist if the stream was broken. If so, don't leak
// them.
- for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
+ i != e; ++i)
CurAbbrevs[i]->dropRef();
- for (unsigned S = 0, e = BlockScope.size(); S != e; ++S) {
+ for (unsigned S = 0, e = static_cast<unsigned>(BlockScope.size());
+ S != e; ++S) {
std::vector<BitCodeAbbrev*> &Abbrevs = BlockScope[S].PrevAbbrevs;
- for (unsigned i = 0, e = Abbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Abbrevs.size());
+ i != e; ++i)
Abbrevs[i]->dropRef();
}
@@ -98,7 +101,8 @@
while (!BlockInfoRecords.empty()) {
BlockInfo &Info = BlockInfoRecords.back();
// Free blockinfo abbrev info.
- for (unsigned i = 0, e = Info.Abbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Info.Abbrevs.size());
+ i != e; ++i)
Info.Abbrevs[i]->dropRef();
BlockInfoRecords.pop_back();
}
@@ -127,7 +131,7 @@
// Skip over any bits that are already consumed.
if (WordBitNo) {
NextChar -= 4;
- Read(WordBitNo);
+ Read(static_cast<unsigned>(WordBitNo));
}
}
@@ -237,7 +241,8 @@
if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
return &BlockInfoRecords.back();
- for (unsigned i = 0, e = BlockInfoRecords.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
+ i != e; ++i)
if (BlockInfoRecords[i].BlockID == BlockID)
return &BlockInfoRecords[i];
return 0;
@@ -282,7 +287,8 @@
// Add the abbrevs specific to this block to the CurAbbrevs list.
if (BlockInfo *Info = getBlockInfo(BlockID)) {
- for (unsigned i = 0, e = Info->Abbrevs.size(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(Info->Abbrevs.size());
+ i != e; ++i) {
CurAbbrevs.push_back(Info->Abbrevs[i]);
CurAbbrevs.back()->addRef();
}
@@ -317,7 +323,8 @@
CurCodeSize = BlockScope.back().PrevCodeSize;
// Delete abbrevs from popped scope.
- for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
+ i != e; ++i)
CurAbbrevs[i]->dropRef();
BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Mon May 5 13:30:58 2008
@@ -70,7 +70,8 @@
while (!BlockInfoRecords.empty()) {
BlockInfo &Info = BlockInfoRecords.back();
// Free blockinfo abbrev info.
- for (unsigned i = 0, e = Info.Abbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Info.Abbrevs.size());
+ i != e; ++i)
Info.Abbrevs[i]->dropRef();
BlockInfoRecords.pop_back();
}
@@ -167,7 +168,8 @@
if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
return &BlockInfoRecords.back();
- for (unsigned i = 0, e = BlockInfoRecords.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
+ i != e; ++i)
if (BlockInfoRecords[i].BlockID == BlockID)
return &BlockInfoRecords[i];
return 0;
@@ -181,7 +183,7 @@
EmitVBR(CodeLen, bitc::CodeLenWidth);
FlushToWord();
- unsigned BlockSizeWordLoc = Out.size();
+ unsigned BlockSizeWordLoc = static_cast<unsigned>(Out.size());
unsigned OldCodeSize = CurCodeSize;
// Emit a placeholder, which will be replaced when the block is popped.
@@ -197,7 +199,8 @@
// If there is a blockinfo for this BlockID, add all the predefined abbrevs
// to the abbrev list.
if (BlockInfo *Info = getBlockInfo(BlockID)) {
- for (unsigned i = 0, e = Info->Abbrevs.size(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(Info->Abbrevs.size());
+ i != e; ++i) {
CurAbbrevs.push_back(Info->Abbrevs[i]);
Info->Abbrevs[i]->addRef();
}
@@ -208,7 +211,8 @@
assert(!BlockScope.empty() && "Block scope imbalance!");
// Delete all abbrevs.
- for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
+ i != e; ++i)
CurAbbrevs[i]->dropRef();
const Block &B = BlockScope.back();
@@ -219,7 +223,7 @@
FlushToWord();
// Compute the size of the block, in words, not counting the size field.
- unsigned SizeInWords = Out.size()/4-B.StartSizeWord - 1;
+ unsigned SizeInWords= static_cast<unsigned>(Out.size())/4-B.StartSizeWord-1;
unsigned ByteNo = B.StartSizeWord*4;
// Update the block size field in the header of this sub-block.
@@ -283,7 +287,8 @@
Vals.insert(Vals.begin(), Code);
unsigned RecordIdx = 0;
- for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(Abbv->getNumOperandInfos());
+ i != e; ++i) {
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) {
assert(RecordIdx < Vals.size() && "Invalid abbrev/record");
@@ -295,7 +300,7 @@
const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
// Emit a vbr6 to indicate the number of elements present.
- EmitVBR(Vals.size()-RecordIdx, 6);
+ EmitVBR(static_cast<uint32_t>(Vals.size()-RecordIdx), 6);
// Emit each field.
for (; RecordIdx != Vals.size(); ++RecordIdx)
@@ -308,8 +313,8 @@
// form.
EmitCode(bitc::UNABBREV_RECORD);
EmitVBR(Code, 6);
- EmitVBR(Vals.size(), 6);
- for (unsigned i = 0, e = Vals.size(); i != e; ++i)
+ EmitVBR(static_cast<uint32_t>(Vals.size()), 6);
+ for (unsigned i = 0, e = static_cast<unsigned>(Vals.size()); i != e; ++i)
EmitVBR64(Vals[i], 6);
}
}
@@ -323,7 +328,8 @@
void EncodeAbbrev(BitCodeAbbrev *Abbv) {
EmitCode(bitc::DEFINE_ABBREV);
EmitVBR(Abbv->getNumOperandInfos(), 5);
- for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(Abbv->getNumOperandInfos());
+ i != e; ++i) {
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
Emit(Op.isLiteral(), 1);
if (Op.isLiteral()) {
@@ -343,7 +349,8 @@
// Emit the abbreviation as a record.
EncodeAbbrev(Abbv);
CurAbbrevs.push_back(Abbv);
- return CurAbbrevs.size()-1+bitc::FIRST_APPLICATION_ABBREV;
+ return static_cast<unsigned>(CurAbbrevs.size())-1 +
+ bitc::FIRST_APPLICATION_ABBREV;
}
//===--------------------------------------------------------------------===//
Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Mon May 5 13:30:58 2008
@@ -143,7 +143,7 @@
bool containsOneValue() const { return valnos.size() == 1; }
- unsigned getNumValNums() const { return valnos.size(); }
+ unsigned getNumValNums() const { return (unsigned)valnos.size(); }
/// getValNumInfo - Returns pointer to the specified val#.
///
@@ -168,14 +168,15 @@
VNInfo *getNextValue(unsigned MIIdx, MachineInstr *CopyMI,
BumpPtrAllocator &VNInfoAllocator) {
#ifdef __GNUC__
- unsigned Alignment = __alignof__(VNInfo);
+ unsigned Alignment = (unsigned)__alignof__(VNInfo);
#else
// FIXME: ugly.
unsigned Alignment = 8;
#endif
- VNInfo *VNI= static_cast<VNInfo*>(VNInfoAllocator.Allocate(sizeof(VNInfo),
- Alignment));
- new (VNI) VNInfo(valnos.size(), MIIdx, CopyMI);
+ VNInfo *VNI =
+ static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo),
+ Alignment));
+ new (VNI) VNInfo((unsigned)valnos.size(), MIIdx, CopyMI);
valnos.push_back(VNI);
return VNI;
}
@@ -196,7 +197,8 @@
/// addKills - Add a number of kills into the VNInfo kill vector. If this
/// interval is live at a kill point, then the kill is not added.
void addKills(VNInfo *VNI, const SmallVector<unsigned, 4> &kills) {
- for (unsigned i = 0, e = kills.size(); i != e; ++i) {
+ for (unsigned i = 0, e = static_cast<unsigned>(kills.size());
+ i != e; ++i) {
unsigned KillIdx = kills[i];
if (!liveBeforeAndAt(KillIdx)) {
SmallVector<unsigned, 4>::iterator
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon May 5 13:30:58 2008
@@ -131,7 +131,7 @@
const_iterator end() const { return r2iMap_.end(); }
iterator begin() { return r2iMap_.begin(); }
iterator end() { return r2iMap_.end(); }
- unsigned getNumIntervals() const { return r2iMap_.size(); }
+ unsigned getNumIntervals() const { return (unsigned)r2iMap_.size(); }
LiveInterval &getInterval(unsigned reg) {
Reg2IntervalMap::iterator I = r2iMap_.find(reg);
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon May 5 13:30:58 2008
@@ -108,7 +108,7 @@
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
- unsigned size() const { return Insts.size(); }
+ unsigned size() const { return (unsigned)Insts.size(); }
bool empty() const { return Insts.empty(); }
MachineInstr& front() { return Insts.front(); }
@@ -149,7 +149,9 @@
{ return Predecessors.rend(); }
const_pred_reverse_iterator pred_rend() const
{ return Predecessors.rend(); }
- unsigned pred_size() const { return Predecessors.size(); }
+ unsigned pred_size() const {
+ return (unsigned)Predecessors.size();
+ }
bool pred_empty() const { return Predecessors.empty(); }
succ_iterator succ_begin() { return Successors.begin(); }
const_succ_iterator succ_begin() const { return Successors.begin(); }
@@ -163,7 +165,9 @@
{ return Successors.rend(); }
const_succ_reverse_iterator succ_rend() const
{ return Successors.rend(); }
- unsigned succ_size() const { return Successors.size(); }
+ unsigned succ_size() const {
+ return (unsigned)Successors.size();
+ }
bool succ_empty() const { return Successors.empty(); }
// LiveIn management methods.
Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Mon May 5 13:30:58 2008
@@ -168,7 +168,8 @@
/// emitString - This callback is invoked when a String needs to be
/// written to the output stream.
void emitString(const std::string &String) {
- for (unsigned i = 0, N = String.size(); i < N; ++i) {
+ for (unsigned i = 0, N = static_cast<unsigned>(String.size());
+ i < N; ++i) {
unsigned char C = String[i];
emitByte(C);
}
Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Mon May 5 13:30:58 2008
@@ -193,7 +193,7 @@
/// getObjectIndexEnd - Return one past the maximum frame object index...
///
- int getObjectIndexEnd() const { return Objects.size()-NumFixedObjects; }
+ int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
/// getObjectSize - Return the size of the specified object
///
@@ -311,7 +311,7 @@
int CreateStackObject(uint64_t Size, unsigned Alignment) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
Objects.push_back(StackObject(Size, Alignment, -1));
- return Objects.size()-NumFixedObjects-1;
+ return (int)Objects.size()-NumFixedObjects-1;
}
/// RemoveStackObject - Remove or mark dead a statically sized stack object.
@@ -333,7 +333,7 @@
int CreateVariableSizedObject() {
HasVarSizedObjects = true;
Objects.push_back(StackObject(0, 1, -1));
- return Objects.size()-NumFixedObjects-1;
+ return (int)Objects.size()-NumFixedObjects-1;
}
/// getCalleeSavedInfo - Returns a reference to call saved info vector for the
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon May 5 13:30:58 2008
@@ -165,7 +165,7 @@
/// getNumBlockIDs - Return the number of MBB ID's allocated.
///
- unsigned getNumBlockIDs() const { return MBBNumbering.size(); }
+ unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
/// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
/// recomputes them. This guarantees that the MBB numbers are sequential,
@@ -238,7 +238,7 @@
reverse_iterator rend () { return BasicBlocks.rend(); }
const_reverse_iterator rend () const { return BasicBlocks.rend(); }
- unsigned size() const { return BasicBlocks.size(); }
+ unsigned size() const { return (unsigned)BasicBlocks.size();}
bool empty() const { return BasicBlocks.empty(); }
const MachineBasicBlock &front() const { return BasicBlocks.front(); }
MachineBasicBlock &front() { return BasicBlocks.front(); }
@@ -254,7 +254,7 @@
///
unsigned addToMBBNumbering(MachineBasicBlock *MBB) {
MBBNumbering.push_back(MBB);
- return MBBNumbering.size()-1;
+ return (unsigned)MBBNumbering.size()-1;
}
/// removeFromMBBNumbering - Remove the specific machine basic block from our
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Mon May 5 13:30:58 2008
@@ -82,7 +82,7 @@
/// Access to explicit operands of the instruction.
///
- unsigned getNumOperands() const { return Operands.size(); }
+ unsigned getNumOperands() const { return (unsigned)Operands.size(); }
const MachineOperand& getOperand(unsigned i) const {
assert(i < getNumOperands() && "getOperand() out of range!");
@@ -98,7 +98,7 @@
unsigned getNumExplicitOperands() const;
/// Access to memory operands of the instruction
- unsigned getNumMemOperands() const { return MemOperands.size(); }
+ unsigned getNumMemOperands() const { return (unsigned)MemOperands.size(); }
const MachineMemOperand& getMemOperand(unsigned i) const {
assert(i < getNumMemOperands() && "getMemOperand() out of range!");
Modified: llvm/trunk/include/llvm/CodeGen/MachineJumpTableInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineJumpTableInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineJumpTableInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineJumpTableInfo.h Mon May 5 13:30:58 2008
@@ -70,9 +70,9 @@
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) {
assert(Old != New && "Not making a change?");
bool MadeChange = false;
- for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
+ for (size_t i = 0, e = JumpTables.size(); i != e; ++i) {
MachineJumpTableEntry &JTE = JumpTables[i];
- for (unsigned j = 0, e = JTE.MBBs.size(); j != e; ++j)
+ for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
if (JTE.MBBs[j] == Old) {
JTE.MBBs[j] = New;
MadeChange = true;
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon May 5 13:30:58 2008
@@ -1100,7 +1100,7 @@
/// NextLabelID - Return the next unique label id.
///
unsigned NextLabelID() {
- unsigned ID = LabelIDList.size() + 1;
+ unsigned ID = (unsigned)LabelIDList.size() + 1;
LabelIDList.push_back(ID);
return ID;
}
Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon May 5 13:30:58 2008
@@ -152,7 +152,7 @@
/// getLastVirtReg - Return the highest currently assigned virtual register.
///
unsigned getLastVirtReg() const {
- return VRegInfo.size()+TargetRegisterInfo::FirstVirtualRegister-1;
+ return (unsigned)VRegInfo.size()+TargetRegisterInfo::FirstVirtualRegister-1;
}
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Mon May 5 13:30:58 2008
@@ -143,7 +143,7 @@
/// not already. This returns true if this is a new pred.
bool addPred(SUnit *N, bool isCtrl, bool isSpecial,
unsigned PhyReg = 0, int Cost = 1) {
- for (unsigned i = 0, e = Preds.size(); i != e; ++i)
+ for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
if (Preds[i].Dep == N &&
Preds[i].isCtrl == isCtrl && Preds[i].isSpecial == isSpecial)
return false;
@@ -189,14 +189,14 @@
}
bool isPred(SUnit *N) {
- for (unsigned i = 0, e = Preds.size(); i != e; ++i)
+ for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
if (Preds[i].Dep == N)
return true;
return false;
}
bool isSucc(SUnit *N) {
- for (unsigned i = 0, e = Succs.size(); i != e; ++i)
+ for (unsigned i = 0, e = (unsigned)Succs.size(); i != e; ++i)
if (Succs[i].Dep == N)
return true;
return false;
@@ -293,7 +293,7 @@
/// NewSUnit - Creates a new SUnit and return a ptr to it.
///
SUnit *NewSUnit(SDNode *N) {
- SUnits.push_back(SUnit(N, SUnits.size()));
+ SUnits.push_back(SUnit(N, (unsigned)SUnits.size()));
return &SUnits.back();
}
@@ -452,7 +452,7 @@
static SUnitIterator begin(SUnit *N) { return SUnitIterator(N, 0); }
static SUnitIterator end (SUnit *N) {
- return SUnitIterator(N, N->Preds.size());
+ return SUnitIterator(N, (unsigned)N->Preds.size());
}
unsigned getOperand() const { return Operand; }
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon May 5 13:30:58 2008
@@ -163,7 +163,7 @@
return getVTList(VT1, VT2, VT3).VTs;
}
const MVT::ValueType *getNodeValueTypes(std::vector<MVT::ValueType> &VTList) {
- return getVTList(&VTList[0], VTList.size()).VTs;
+ return getVTList(&VTList[0], (unsigned)VTList.size()).VTs;
}
@@ -287,7 +287,7 @@
Ops.push_back(Op2);
Ops.push_back(InFlag);
return getNode(ISD::CALLSEQ_END, NodeTys, &Ops[0],
- Ops.size() - (InFlag.Val == 0 ? 1 : 0));
+ (unsigned)Ops.size() - (InFlag.Val == 0 ? 1 : 0));
}
/// getNode - Gets or creates the specified node.
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon May 5 13:30:58 2008
@@ -972,12 +972,12 @@
SDOperandPtr(SDUse * use_ptr) {
ptr = &use_ptr->getSDOperand();
- object_size = sizeof(SDUse);
+ object_size = (int)sizeof(SDUse);
}
SDOperandPtr(const SDOperand * op_ptr) {
ptr = op_ptr;
- object_size = sizeof(SDOperand);
+ object_size = (int)sizeof(SDOperand);
}
const SDOperand operator *() { return *ptr; }
@@ -1107,7 +1107,7 @@
/// getOperandNum - Retrive a number of a current operand.
unsigned getOperandNum() const {
assert(Op && "Cannot dereference end iterator!");
- return (Op - Op->getUser()->OperandList);
+ return (unsigned)(Op - Op->getUser()->OperandList);
}
/// Retrieve a reference to the current operand.
Modified: llvm/trunk/include/llvm/Debugger/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Debugger/Debugger.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Debugger/Debugger.h (original)
+++ llvm/trunk/include/llvm/Debugger/Debugger.h Mon May 5 13:30:58 2008
@@ -67,7 +67,9 @@
void setProgramArguments(It I, It E) {
ProgramArguments.assign(I, E);
}
- unsigned getNumProgramArguments() const { return ProgramArguments.size(); }
+ unsigned getNumProgramArguments() const {
+ return static_cast<unsigned>(ProgramArguments.size());
+ }
const std::string &getProgramArgument(unsigned i) const {
return ProgramArguments[i];
}
Modified: llvm/trunk/include/llvm/Debugger/SourceFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Debugger/SourceFile.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Debugger/SourceFile.h (original)
+++ llvm/trunk/include/llvm/Debugger/SourceFile.h Mon May 5 13:30:58 2008
@@ -74,7 +74,7 @@
///
unsigned getNumLines() const {
if (LineOffset.empty()) calculateLineOffsets();
- return LineOffset.size();
+ return static_cast<unsigned>(LineOffset.size());
}
private:
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon May 5 13:30:58 2008
@@ -397,8 +397,7 @@
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
std::random_access_iterator_tag) {
- typename std::iterator_traits<InputIterator>::difference_type NumIdx =
- std::distance(IdxBegin, IdxEnd);
+ unsigned NumIdx = static_cast<unsigned>(std::distance(IdxBegin, IdxEnd));
if (NumIdx > 0) {
// This requires that the itoerator points to contiguous memory.
@@ -430,8 +429,7 @@
// have an iterator we can do
// arithmetic on in constant time
std::random_access_iterator_tag) {
- typename std::iterator_traits<InputIterator>::difference_type NumIdx =
- std::distance(IdxBegin, IdxEnd);
+ unsigned NumIdx = static_cast<unsigned>(std::distance(IdxBegin, IdxEnd));
if (NumIdx > 0) {
// This requires that the iterator points to contiguous memory.
@@ -961,7 +959,8 @@
Instruction *InsertBefore = 0) {
return new(1) CallInst(F, Name, InsertBefore);
}
- static CallInst *Create(Value *F, const std::string &Name, BasicBlock *InsertAtEnd) {
+ static CallInst *Create(Value *F, const std::string &Name,
+ BasicBlock *InsertAtEnd) {
return new(1) CallInst(F, Name, InsertAtEnd);
}
Modified: llvm/trunk/include/llvm/ParameterAttributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ParameterAttributes.h (original)
+++ llvm/trunk/include/llvm/ParameterAttributes.h Mon May 5 13:30:58 2008
@@ -124,7 +124,7 @@
template <typename Iter>
static PAListPtr get(const Iter &I, const Iter &E) {
if (I == E) return PAListPtr(); // Empty list.
- return get(&*I, E-I);
+ return get(&*I, static_cast<unsigned>(E-I));
}
/// addAttr - Add the specified attribute at the specified index to this
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Mon May 5 13:30:58 2008
@@ -146,7 +146,7 @@
public:
virtual unsigned getNumContainedManagers() {
- return PassManagers.size();
+ return (unsigned)PassManagers.size();
}
/// Schedule pass P for execution. Make sure that passes required by
@@ -306,7 +306,7 @@
const std::vector<AnalysisID> &Set) const;
virtual unsigned getNumContainedPasses() {
- return PassVector.size();
+ return (unsigned)PassVector.size();
}
virtual PassManagerType getPassManagerType() const {
Modified: llvm/trunk/include/llvm/Support/AlignOf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/AlignOf.h (original)
+++ llvm/trunk/include/llvm/Support/AlignOf.h Mon May 5 13:30:58 2008
@@ -34,7 +34,8 @@
/// compile-time constant (e.g., for template instantiation).
template <typename T>
struct AlignOf {
- enum { Alignment = sizeof(AlignmentCalcImpl<T>) - sizeof(T) };
+ enum { Alignment =
+ static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T)) };
enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Mon May 5 13:30:58 2008
@@ -25,7 +25,7 @@
~MallocAllocator() {}
void Reset() {}
- void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); }
+ void *Allocate(size_t Size, size_t Alignment) { return malloc(Size); }
template <typename T>
void *Allocate() { return reinterpret_cast<T*>(malloc(sizeof(T))); }
@@ -45,7 +45,7 @@
~BumpPtrAllocator();
void Reset();
- void *Allocate(unsigned Size, unsigned Alignment);
+ void *Allocate(size_t Size, size_t Alignment);
template <typename T>
void *Allocate() {
Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Mon May 5 13:30:58 2008
@@ -219,12 +219,12 @@
Option *getNextRegisteredOption() const { return NextRegistered; }
// Return the width of the option tag for printing...
- virtual unsigned getOptionWidth() const = 0;
+ virtual size_t getOptionWidth() const = 0;
// printOptionInfo - Print out information about this option. The
// to-be-maintained width is specified.
//
- virtual void printOptionInfo(unsigned GlobalWidth) const = 0;
+ virtual void printOptionInfo(size_t GlobalWidth) const = 0;
virtual void getExtraOptionNames(std::vector<const char*> &OptionNames) {}
@@ -334,7 +334,8 @@
template<class Opt>
void apply(Opt &O) const {
- for (unsigned i = 0, e = Values.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Values.size());
+ i != e; ++i)
O.getParser().addLiteralOption(Values[i].first, Values[i].second.first,
Values[i].second.second);
}
@@ -378,12 +379,12 @@
virtual const char *getDescription(unsigned N) const = 0;
// Return the width of the option tag for printing...
- virtual unsigned getOptionWidth(const Option &O) const;
+ virtual size_t getOptionWidth(const Option &O) const;
// printOptionInfo - Print out information about this option. The
// to-be-maintained width is specified.
//
- virtual void printOptionInfo(const Option &O, unsigned GlobalWidth) const;
+ virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const;
void initialize(Option &O) {
// All of the modifiers for the option have been processed by now, so the
@@ -459,7 +460,8 @@
else
ArgVal = ArgName;
- for (unsigned i = 0, e = Values.size(); i != e; ++i)
+ for (unsigned i = 0, e = static_cast<unsigned>(Values.size());
+ i != e; ++i)
if (ArgVal == Values[i].first) {
V = Values[i].second.first;
return false;
@@ -502,12 +504,12 @@
void initialize(Option &O) {}
// Return the width of the option tag for printing...
- unsigned getOptionWidth(const Option &O) const;
+ size_t getOptionWidth(const Option &O) const;
// printOptionInfo - Print out information about this option. The
// to-be-maintained width is specified.
//
- void printOptionInfo(const Option &O, unsigned GlobalWidth) const;
+ void printOptionInfo(const Option &O, size_t GlobalWidth) const;
// getValueName - Overload in subclass to provide a better default value.
virtual const char *getValueName() const { return "value"; }
@@ -815,8 +817,8 @@
}
// Forward printing stuff to the parser...
- virtual unsigned getOptionWidth() const {return Parser.getOptionWidth(*this);}
- virtual void printOptionInfo(unsigned GlobalWidth) const {
+ virtual size_t getOptionWidth() const {return Parser.getOptionWidth(*this);}
+ virtual void printOptionInfo(size_t GlobalWidth) const {
Parser.printOptionInfo(*this, GlobalWidth);
}
@@ -981,8 +983,8 @@
}
// Forward printing stuff to the parser...
- virtual unsigned getOptionWidth() const {return Parser.getOptionWidth(*this);}
- virtual void printOptionInfo(unsigned GlobalWidth) const {
+ virtual size_t getOptionWidth() const {return Parser.getOptionWidth(*this);}
+ virtual void printOptionInfo(size_t GlobalWidth) const {
Parser.printOptionInfo(*this, GlobalWidth);
}
@@ -1167,8 +1169,8 @@
}
// Forward printing stuff to the parser...
- virtual unsigned getOptionWidth() const {return Parser.getOptionWidth(*this);}
- virtual void printOptionInfo(unsigned GlobalWidth) const {
+ virtual size_t getOptionWidth() const {return Parser.getOptionWidth(*this);}
+ virtual void printOptionInfo(size_t GlobalWidth) const {
Parser.printOptionInfo(*this, GlobalWidth);
}
@@ -1260,8 +1262,8 @@
return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
}
// Handle printing stuff...
- virtual unsigned getOptionWidth() const;
- virtual void printOptionInfo(unsigned GlobalWidth) const;
+ virtual size_t getOptionWidth() const;
+ virtual void printOptionInfo(size_t GlobalWidth) const;
void done() {
if (!hasArgStr())
Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon May 5 13:30:58 2008
@@ -175,8 +175,8 @@
child_iterator TargetIt = DOTTraits::getEdgeTarget(Node, EI);
// Figure out which edge this targets...
- unsigned Offset = std::distance(GTraits::child_begin(TargetNode),
- TargetIt);
+ unsigned Offset =
+ (unsigned)std::distance(GTraits::child_begin(TargetNode), TargetIt);
DestPort = static_cast<int>(Offset);
}
Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Mon May 5 13:30:58 2008
@@ -40,7 +40,7 @@
const char *getBufferStart() const { return BufferStart; }
const char *getBufferEnd() const { return BufferEnd; }
- unsigned getBufferSize() const { return BufferEnd-BufferStart; }
+ size_t getBufferSize() const { return BufferEnd-BufferStart; }
/// getBufferIdentifier - Return an identifier for this buffer, typically the
/// filename it was read from.
@@ -71,14 +71,14 @@
/// is completely initialized to zeros. Note that the caller should
/// initialize the memory allocated by this method. The memory is owned by
/// the MemoryBuffer object.
- static MemoryBuffer *getNewMemBuffer(unsigned Size,
+ static MemoryBuffer *getNewMemBuffer(size_t Size,
const char *BufferName = "");
/// getNewUninitMemBuffer - Allocate a new MemoryBuffer of the specified size
/// that is not initialized. Note that the caller should initialize the
/// memory allocated by this method. The memory is owned by the MemoryBuffer
/// object.
- static MemoryBuffer *getNewUninitMemBuffer(unsigned Size,
+ static MemoryBuffer *getNewUninitMemBuffer(size_t Size,
const char *BufferName = "");
/// getSTDIN - Read all of stdin into a file buffer, and return it. This
Modified: llvm/trunk/include/llvm/Support/OutputBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/OutputBuffer.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/OutputBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/OutputBuffer.h Mon May 5 13:30:58 2008
@@ -107,8 +107,10 @@
outxword(X);
}
void outstring(const std::string &S, unsigned Length) {
- unsigned len_to_copy = S.length() < Length ? S.length() : Length;
- unsigned len_to_fill = S.length() < Length ? Length - S.length() : 0;
+ unsigned len_to_copy = static_cast<unsigned>(S.length()) < Length
+ ? static_cast<unsigned>(S.length()) : Length;
+ unsigned len_to_fill = static_cast<unsigned>(S.length()) < Length
+ ? Length - static_cast<unsigned>(S.length()) : 0;
for (unsigned i = 0; i < len_to_copy; ++i)
outbyte(S[i]);
Modified: llvm/trunk/include/llvm/System/Path.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Mon May 5 13:30:58 2008
@@ -207,14 +207,14 @@
/// @returns true if \p this and \p that refer to the same thing.
/// @brief Equality Operator
bool operator==(const Path &that) const {
- return 0 == path.compare(that.path);
+ return path == that.path;
}
/// Compares \p this Path with \p that Path for inequality.
/// @returns true if \p this and \p that refer to different things.
/// @brief Inequality Operator
bool operator!=(const Path &that) const {
- return 0 != path.compare(that.path);
+ return path != that.path;
}
/// Determines if \p this Path is less than \p that Path. This is required
@@ -224,7 +224,7 @@
/// @returns true if \p this path is lexicographically less than \p that.
/// @brief Less Than Operator
bool operator<(const Path& that) const {
- return 0 > path.compare(that.path);
+ return path < that.path;
}
/// @}
@@ -288,7 +288,7 @@
const char *c_str() const { return path.c_str(); }
/// size - Return the length in bytes of this path name.
- unsigned size() const { return path.size(); }
+ size_t size() const { return path.size(); }
/// empty - Returns true if the path is empty.
unsigned empty() const { return path.empty(); }
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon May 5 13:30:58 2008
@@ -99,7 +99,7 @@
/// getNumRegs - Return the number of registers in this class.
///
- unsigned getNumRegs() const { return RegsEnd-RegsBegin; }
+ unsigned getNumRegs() const { return (unsigned)(RegsEnd-RegsBegin); }
/// getRegister - Return the specified register in the class.
///
@@ -465,7 +465,7 @@
regclass_iterator regclass_end() const { return RegClassEnd; }
unsigned getNumRegClasses() const {
- return regclass_end()-regclass_begin();
+ return (unsigned)(regclass_end()-regclass_begin());
}
/// getRegClass - Returns the register class associated with the enumeration
Modified: llvm/trunk/include/llvm/User.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/User.h?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/include/llvm/User.h (original)
+++ llvm/trunk/include/llvm/User.h Mon May 5 13:30:58 2008
@@ -39,7 +39,7 @@
///
unsigned NumOperands;
- void *operator new(size_t s, unsigned) {
+ void *operator new(size_t s, size_t) {
return ::operator new(s);
}
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps)
Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Mon May 5 13:30:58 2008
@@ -45,7 +45,7 @@
/// Allocate - Allocate and return at least the specified number of bytes.
///
- void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
+ void *Allocate(size_t AllocSize, size_t Alignment, MemRegion **RegPtr) {
char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
& ~((uintptr_t) Alignment-1));
@@ -113,7 +113,7 @@
TheMemory = MRP;
}
-void *BumpPtrAllocator::Allocate(unsigned Size, unsigned Align) {
+void *BumpPtrAllocator::Allocate(size_t Size, size_t Align) {
MemRegion *MRP = (MemRegion*)TheMemory;
void *Ptr = MRP->Allocate(Size, Align, &MRP);
TheMemory = MRP;
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Mon May 5 13:30:58 2008
@@ -115,7 +115,7 @@
OptionNames.push_back(O->ArgStr);
// Handle named options.
- for (unsigned i = 0, e = OptionNames.size(); i != e; ++i) {
+ for (size_t i = 0, e = OptionNames.size(); i != e; ++i) {
// Add argument to the argument map!
if (!OptionsMap.insert(std::pair<std::string,Option*>(OptionNames[i],
O)).second) {
@@ -223,7 +223,7 @@
// see if there options that satisfy the predicate. If we find one, return it,
// otherwise return null.
//
-static Option *getOptionPred(std::string Name, unsigned &Length,
+static Option *getOptionPred(std::string Name, size_t &Length,
bool (*Pred)(const Option*),
std::map<std::string, Option*> &OptionsMap) {
@@ -329,7 +329,7 @@
// Parse the value of the environment variable into a "command line"
// and hand it off to ParseCommandLineOptions().
ParseCStringVector(newArgv, envValue);
- int newArgc = newArgv.size();
+ int newArgc = static_cast<int>(newArgv.size());
ParseCommandLineOptions(newArgc, &newArgv[0], Overview, ReadResponseFiles);
// Free all the strdup()ed strings.
@@ -391,7 +391,7 @@
newArgv.push_back(strdup(argv[0]));
ExpandResponseFiles(argc, argv, newArgv);
argv = &newArgv[0];
- argc = newArgv.size();
+ argc = static_cast<int>(newArgv.size());
}
sys::Path progname(argv[0]);
@@ -420,7 +420,7 @@
// Calculate how many positional values are _required_.
bool UnboundedFound = false;
- for (unsigned i = ConsumeAfterOpt != 0, e = PositionalOpts.size();
+ for (size_t i = ConsumeAfterOpt != 0, e = PositionalOpts.size();
i != e; ++i) {
Option *Opt = PositionalOpts[i];
if (RequiresValue(Opt))
@@ -525,7 +525,7 @@
if (Handler == 0) {
std::string RealName(ArgName);
if (RealName.size() > 1) {
- unsigned Length = 0;
+ size_t Length = 0;
Option *PGOpt = getOptionPred(RealName, Length, isPrefixedOrGrouping,
Opts);
@@ -627,8 +627,8 @@
} else if (ConsumeAfterOpt == 0) {
// Positional args have already been handled if ConsumeAfter is specified...
- unsigned ValNo = 0, NumVals = PositionalVals.size();
- for (unsigned i = 0, e = PositionalOpts.size(); i != e; ++i) {
+ unsigned ValNo = 0, NumVals = static_cast<unsigned>(PositionalVals.size());
+ for (size_t i = 0, e = PositionalOpts.size(); i != e; ++i) {
if (RequiresValue(PositionalOpts[i])) {
ProvidePositionalOption(PositionalOpts[i], PositionalVals[ValNo].first,
PositionalVals[ValNo].second);
@@ -662,7 +662,7 @@
} else {
assert(ConsumeAfterOpt && NumPositionalRequired <= PositionalVals.size());
unsigned ValNo = 0;
- for (unsigned j = 1, e = PositionalOpts.size(); j != e; ++j)
+ for (size_t j = 1, e = PositionalOpts.size(); j != e; ++j)
if (RequiresValue(PositionalOpts[j])) {
ErrorParsing |= ProvidePositionalOption(PositionalOpts[j],
PositionalVals[ValNo].first,
@@ -775,13 +775,13 @@
//
// Return the width of the option tag for printing...
-unsigned alias::getOptionWidth() const {
+size_t alias::getOptionWidth() const {
return std::strlen(ArgStr)+6;
}
// Print out the option for the alias.
-void alias::printOptionInfo(unsigned GlobalWidth) const {
- unsigned L = std::strlen(ArgStr);
+void alias::printOptionInfo(size_t GlobalWidth) const {
+ size_t L = std::strlen(ArgStr);
cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - "
<< HelpStr << "\n";
}
@@ -796,8 +796,8 @@
//
// Return the width of the option tag for printing...
-unsigned basic_parser_impl::getOptionWidth(const Option &O) const {
- unsigned Len = std::strlen(O.ArgStr);
+size_t basic_parser_impl::getOptionWidth(const Option &O) const {
+ size_t Len = std::strlen(O.ArgStr);
if (const char *ValName = getValueName())
Len += std::strlen(getValueStr(O, ValName))+3;
@@ -808,7 +808,7 @@
// to-be-maintained width is specified.
//
void basic_parser_impl::printOptionInfo(const Option &O,
- unsigned GlobalWidth) const {
+ size_t GlobalWidth) const {
cout << " -" << O.ArgStr;
if (const char *ValName = getValueName())
@@ -926,16 +926,16 @@
// Return the width of the option tag for printing...
-unsigned generic_parser_base::getOptionWidth(const Option &O) const {
+size_t generic_parser_base::getOptionWidth(const Option &O) const {
if (O.hasArgStr()) {
- unsigned Size = std::strlen(O.ArgStr)+6;
+ size_t Size = std::strlen(O.ArgStr)+6;
for (unsigned i = 0, e = getNumOptions(); i != e; ++i)
- Size = std::max(Size, (unsigned)std::strlen(getOption(i))+8);
+ Size = std::max(Size, std::strlen(getOption(i))+8);
return Size;
} else {
- unsigned BaseSize = 0;
+ size_t BaseSize = 0;
for (unsigned i = 0, e = getNumOptions(); i != e; ++i)
- BaseSize = std::max(BaseSize, (unsigned)std::strlen(getOption(i))+8);
+ BaseSize = std::max(BaseSize, std::strlen(getOption(i))+8);
return BaseSize;
}
}
@@ -944,14 +944,14 @@
// to-be-maintained width is specified.
//
void generic_parser_base::printOptionInfo(const Option &O,
- unsigned GlobalWidth) const {
+ size_t GlobalWidth) const {
if (O.hasArgStr()) {
- unsigned L = std::strlen(O.ArgStr);
+ size_t L = std::strlen(O.ArgStr);
cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ')
<< " - " << O.HelpStr << "\n";
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
- unsigned NumSpaces = GlobalWidth-strlen(getOption(i))-8;
+ size_t NumSpaces = GlobalWidth-strlen(getOption(i))-8;
cout << " =" << getOption(i) << std::string(NumSpaces, ' ')
<< " - " << getDescription(i) << "\n";
}
@@ -959,7 +959,7 @@
if (O.HelpStr[0])
cout << " " << O.HelpStr << "\n";
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
- unsigned L = std::strlen(getOption(i));
+ size_t L = std::strlen(getOption(i));
cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
<< " - " << getDescription(i) << "\n";
}
@@ -974,7 +974,7 @@
namespace {
class HelpPrinter {
- unsigned MaxArgLen;
+ size_t MaxArgLen;
const Option *EmptyArg;
const bool ShowHidden;
@@ -1030,7 +1030,7 @@
PositionalOpts[0]->getNumOccurrencesFlag() == ConsumeAfter)
CAOpt = PositionalOpts[0];
- for (unsigned i = CAOpt != 0, e = PositionalOpts.size(); i != e; ++i) {
+ for (size_t i = CAOpt != 0, e = PositionalOpts.size(); i != e; ++i) {
if (PositionalOpts[i]->ArgStr[0])
cout << " --" << PositionalOpts[i]->ArgStr;
cout << " " << PositionalOpts[i]->HelpStr;
@@ -1043,11 +1043,11 @@
// Compute the maximum argument length...
MaxArgLen = 0;
- for (unsigned i = 0, e = Opts.size(); i != e; ++i)
+ for (size_t i = 0, e = Opts.size(); i != e; ++i)
MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth());
cout << "OPTIONS:\n";
- for (unsigned i = 0, e = Opts.size(); i != e; ++i)
+ for (size_t i = 0, e = Opts.size(); i != e; ++i)
Opts[i].second->printOptionInfo(MaxArgLen);
// Print any extra help the user has declared.
Modified: llvm/trunk/lib/Support/FileUtilities.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileUtilities.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FileUtilities.cpp (original)
+++ llvm/trunk/lib/Support/FileUtilities.cpp Mon May 5 13:30:58 2008
@@ -98,7 +98,8 @@
if (*F1NumEnd == 'D' || *F1NumEnd == 'd') {
// Copy string into tmp buffer to replace the 'D' with an 'e'.
SmallString<200> StrTmp(F1P, EndOfNumber(F1NumEnd)+1);
- StrTmp[F1NumEnd-F1P] = 'e'; // Strange exponential notation!
+ // Strange exponential notation!
+ StrTmp[static_cast<unsigned>(F1NumEnd-F1P)] = 'e';
V1 = strtod(&StrTmp[0], const_cast<char**>(&F1NumEnd));
F1NumEnd = F1P + (F1NumEnd-&StrTmp[0]);
@@ -107,7 +108,8 @@
if (*F2NumEnd == 'D' || *F2NumEnd == 'd') {
// Copy string into tmp buffer to replace the 'D' with an 'e'.
SmallString<200> StrTmp(F2P, EndOfNumber(F2NumEnd)+1);
- StrTmp[F2NumEnd-F2P] = 'e'; // Strange exponential notation!
+ // Strange exponential notation!
+ StrTmp[static_cast<unsigned>(F2NumEnd-F2P)] = 'e';
V2 = strtod(&StrTmp[0], const_cast<char**>(&F2NumEnd));
F2NumEnd = F2P + (F2NumEnd-&StrTmp[0]);
Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Mon May 5 13:30:58 2008
@@ -58,7 +58,7 @@
AddInteger(DoubleToBits(D));
}
void FoldingSetNodeID::AddString(const std::string &String) {
- unsigned Size = String.size();
+ unsigned Size = static_cast<unsigned>(String.size());
Bits.push_back(Size);
if (!Size) return;
@@ -98,7 +98,7 @@
/// lookup the node in the FoldingSetImpl.
unsigned FoldingSetNodeID::ComputeHash() const {
// This is adapted from SuperFastHash by Paul Hsieh.
- unsigned Hash = Bits.size();
+ unsigned Hash = static_cast<unsigned>(Bits.size());
for (const unsigned *BP = &Bits[0], *E = BP+Bits.size(); BP != E; ++BP) {
unsigned Data = *BP;
Hash += Data & 0xFFFF;
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Mon May 5 13:30:58 2008
@@ -106,7 +106,7 @@
/// that is completely initialized to zeros. Note that the caller should
/// initialize the memory allocated by this method. The memory is owned by
/// the MemoryBuffer object.
-MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(unsigned Size,
+MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
const char *BufferName) {
char *Buf = new char[Size+1];
Buf[Size] = 0;
@@ -120,7 +120,7 @@
/// is completely initialized to zeros. Note that the caller should
/// initialize the memory allocated by this method. The memory is owned by
/// the MemoryBuffer object.
-MemoryBuffer *MemoryBuffer::getNewMemBuffer(unsigned Size,
+MemoryBuffer *MemoryBuffer::getNewMemBuffer(size_t Size,
const char *BufferName) {
MemoryBuffer *SB = getNewUninitMemBuffer(Size, BufferName);
memset(const_cast<char*>(SB->getBufferStart()), 0, Size+1);
@@ -214,7 +214,7 @@
SB.reset(MemoryBuffer::getNewUninitMemBuffer(FileSize, Filename));
char *BufPtr = const_cast<char*>(SB->getBufferStart());
- unsigned BytesLeft = FileSize;
+ size_t BytesLeft = FileSize;
while (BytesLeft) {
ssize_t NumRead = ::read(FD, BufPtr, BytesLeft);
if (NumRead != -1) {
Modified: llvm/trunk/lib/Support/Statistic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Statistic.cpp (original)
+++ llvm/trunk/lib/Support/Statistic.cpp Mon May 5 13:30:58 2008
@@ -90,7 +90,7 @@
// Figure out how long the biggest Value and Name fields are.
unsigned MaxNameLen = 0, MaxValLen = 0;
- for (unsigned i = 0, e = Stats.size(); i != e; ++i) {
+ for (size_t i = 0, e = Stats.size(); i != e; ++i) {
MaxValLen = std::max(MaxValLen,
(unsigned)utostr(Stats[i]->getValue()).size());
MaxNameLen = std::max(MaxNameLen,
@@ -106,7 +106,7 @@
<< "===" << std::string(73, '-') << "===\n\n";
// Print all of the statistics.
- for (unsigned i = 0, e = Stats.size(); i != e; ++i) {
+ for (size_t i = 0, e = Stats.size(); i != e; ++i) {
std::string CountStr = utostr(Stats[i]->getValue());
OutStream << std::string(MaxValLen-CountStr.size(), ' ')
<< CountStr << " " << Stats[i]->getName()
Modified: llvm/trunk/lib/Support/StringExtras.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringExtras.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/Support/StringExtras.cpp (original)
+++ llvm/trunk/lib/Support/StringExtras.cpp Mon May 5 13:30:58 2008
@@ -22,7 +22,7 @@
/// The Source source string is updated in place to remove the returned string
/// and any delimiter prefix from it.
std::string llvm::getToken(std::string &Source, const char *Delimiters) {
- unsigned NumDelimiters = std::strlen(Delimiters);
+ size_t NumDelimiters = std::strlen(Delimiters);
// Figure out where the token starts.
std::string::size_type Start =
Modified: llvm/trunk/lib/System/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/System/Path.cpp (original)
+++ llvm/trunk/lib/System/Path.cpp Mon May 5 13:30:58 2008
@@ -124,7 +124,8 @@
if (canRead()) {
std::string Magic;
if (getMagicNumber(Magic, 64))
- switch (IdentifyFileType(Magic.c_str(), Magic.length())) {
+ switch (IdentifyFileType(Magic.c_str(),
+ static_cast<unsigned>(Magic.length()))) {
default: return false;
case Mach_O_FixedVirtualMemorySharedLib_FileType:
case Mach_O_DynamicallyLinkedSharedLib_FileType:
@@ -167,7 +168,7 @@
bool Path::hasMagicNumber(const std::string &Magic) const {
std::string actualMagic;
- if (getMagicNumber(actualMagic, Magic.size()))
+ if (getMagicNumber(actualMagic, static_cast<unsigned>(Magic.size())))
return Magic == actualMagic;
return false;
}
@@ -204,7 +205,7 @@
// If the path is all slashes, return a single slash.
// Otherwise, remove all trailing slashes.
- signed pos = path.size() - 1;
+ signed pos = static_cast<signed>(path.size()) - 1;
while (pos >= 0 && path[pos] == Sep)
--pos;
Modified: llvm/trunk/lib/System/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Memory.inc (original)
+++ llvm/trunk/lib/System/Unix/Memory.inc Mon May 5 13:30:58 2008
@@ -28,7 +28,7 @@
std::string *ErrMsg) {
if (NumBytes == 0) return MemoryBlock();
- long pageSize = Process::GetPageSize();
+ unsigned pageSize = Process::GetPageSize();
unsigned NumPages = (NumBytes+pageSize-1)/pageSize;
int fd = -1;
Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Mon May 5 13:30:58 2008
@@ -566,7 +566,7 @@
path.copy(pathname,MAXPATHLEN);
// Null-terminate the last component
- int lastchar = path.length() - 1 ;
+ size_t lastchar = path.length() - 1 ;
if (pathname[lastchar] != '/')
++lastchar;
@@ -639,7 +639,7 @@
// Otherwise, try to just remove the one directory.
char pathname[MAXPATHLEN];
path.copy(pathname, MAXPATHLEN);
- int lastchar = path.length() - 1 ;
+ size_t lastchar = path.length() - 1;
if (pathname[lastchar] == '/')
pathname[lastchar] = 0;
else
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Mon May 5 13:30:58 2008
@@ -58,7 +58,7 @@
return Path();
// Now we have a colon separated list of directories to search; try them.
- unsigned PathLen = strlen(PathStr);
+ size_t PathLen = strlen(PathStr);
while (PathLen) {
// Find the first colon...
const char *Colon = std::find(PathStr, PathStr+PathLen, ':');
Modified: llvm/trunk/lib/System/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Signals.inc?rev=50659&r1=50658&r2=50659&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Signals.inc (original)
+++ llvm/trunk/lib/System/Unix/Signals.inc Mon May 5 13:30:58 2008
@@ -65,7 +65,8 @@
static void PrintStackTrace() {
#ifdef HAVE_BACKTRACE
// Use backtrace() to output a backtrace on Linux systems with glibc.
- int depth = backtrace(StackTrace, array_lengthof(StackTrace));
+ int depth = backtrace(StackTrace,
+ static_cast<int>(array_lengthof(StackTrace)));
backtrace_symbols_fd(StackTrace, depth, STDERR_FILENO);
#endif
}
More information about the llvm-commits
mailing list