summaryrefslogtreecommitdiff
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-05-05 18:30:58 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-05-05 18:30:58 +0000
commit34cd4a484e532cc463fd5a4bf59b88d13c5467c1 (patch)
treeeefdfb1d225da0317e7f7912079c430b5c3ed92c /include/llvm/Support
parentb61bfdb56e1c018f10a2c1c9fb49d7e2a78ed24e (diff)
downloadllvm-34cd4a484e532cc463fd5a4bf59b88d13c5467c1.tar.gz
llvm-34cd4a484e532cc463fd5a4bf59b88d13c5467c1.tar.bz2
llvm-34cd4a484e532cc463fd5a4bf59b88d13c5467c1.tar.xz
Fix more -Wshorten-64-to-32 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/AlignOf.h3
-rw-r--r--include/llvm/Support/Allocator.h4
-rw-r--r--include/llvm/Support/CommandLine.h34
-rw-r--r--include/llvm/Support/GraphWriter.h4
-rw-r--r--include/llvm/Support/MemoryBuffer.h6
-rw-r--r--include/llvm/Support/OutputBuffer.h6
6 files changed, 31 insertions, 26 deletions
diff --git a/include/llvm/Support/AlignOf.h b/include/llvm/Support/AlignOf.h
index 108c59f0eb..aecb478eef 100644
--- a/include/llvm/Support/AlignOf.h
+++ b/include/llvm/Support/AlignOf.h
@@ -34,7 +34,8 @@ private:
/// 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 };
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h
index fc82597be4..33cdca13e6 100644
--- a/include/llvm/Support/Allocator.h
+++ b/include/llvm/Support/Allocator.h
@@ -25,7 +25,7 @@ public:
~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 @@ public:
~BumpPtrAllocator();
void Reset();
- void *Allocate(unsigned Size, unsigned Alignment);
+ void *Allocate(size_t Size, size_t Alignment);
template <typename T>
void *Allocate() {
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index 27782c875f..f4db8c4bf8 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -219,12 +219,12 @@ public:
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 @@ public:
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 @@ struct generic_parser_base {
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 @@ public:
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 @@ struct basic_parser_impl { // non-template implementation of basic_parser<t>
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 @@ class opt : public Option,
}
// 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 @@ class list : public Option, public list_storage<DataType, Storage> {
}
// 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 @@ class bits : public Option, public bits_storage<DataType, Storage> {
}
// 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 @@ class alias : public Option {
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())
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index 5ddc47e0a8..cb9199162e 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -175,8 +175,8 @@ public:
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);
}
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index 8c36791be5..ac77f6c9a1 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -40,7 +40,7 @@ public:
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 @@ public:
/// 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
diff --git a/include/llvm/Support/OutputBuffer.h b/include/llvm/Support/OutputBuffer.h
index d16adbd93f..0fedb15e40 100644
--- a/include/llvm/Support/OutputBuffer.h
+++ b/include/llvm/Support/OutputBuffer.h
@@ -107,8 +107,10 @@ namespace llvm {
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]);