[llvm] r186736 - Fix size_t -> uint warnings with MSVC 64-bit build

Matt Arsenault Matthew.Arsenault at amd.com
Fri Jul 19 17:20:11 PDT 2013


Author: arsenm
Date: Fri Jul 19 19:20:10 2013
New Revision: 186736

URL: http://llvm.org/viewvc/llvm-project?rev=186736&view=rev
Log:
Fix size_t -> uint warnings with MSVC 64-bit build

Modified:
    llvm/trunk/include/llvm/Support/CFG.h
    llvm/trunk/include/llvm/Support/IntegersSubset.h
    llvm/trunk/include/llvm/Support/SourceMgr.h
    llvm/trunk/lib/Support/SourceMgr.cpp

Modified: llvm/trunk/include/llvm/Support/CFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=186736&r1=186735&r2=186736&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CFG.h (original)
+++ llvm/trunk/include/llvm/Support/CFG.h Fri Jul 19 19:20:10 2013
@@ -328,7 +328,7 @@ template <> struct GraphTraits<Function*
   typedef Function::iterator nodes_iterator;
   static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
   static nodes_iterator nodes_end  (Function *F) { return F->end(); }
-  static unsigned       size       (Function *F) { return F->size(); }
+  static size_t         size       (Function *F) { return F->size(); }
 };
 template <> struct GraphTraits<const Function*> :
   public GraphTraits<const BasicBlock*> {
@@ -338,7 +338,7 @@ template <> struct GraphTraits<const Fun
   typedef Function::const_iterator nodes_iterator;
   static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
   static nodes_iterator nodes_end  (const Function *F) { return F->end(); }
-  static unsigned       size       (const Function *F) { return F->size(); }
+  static size_t         size       (const Function *F) { return F->size(); }
 };
 
 

Modified: llvm/trunk/include/llvm/Support/IntegersSubset.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IntegersSubset.h?rev=186736&r1=186735&r2=186736&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/IntegersSubset.h (original)
+++ llvm/trunk/include/llvm/Support/IntegersSubset.h Fri Jul 19 19:20:10 2013
@@ -361,7 +361,7 @@ public:
                        FlatCollection.end(),
                        CheckingVal) != FlatCollection.end();
 
-    for (unsigned i = 0, e = getNumItems(); i < e; ++i) {
+    for (size_t i = 0, e = getNumItems(); i < e; ++i) {
       if (RangeLinks[i].first == RangeLinks[i].second) {
         if (*RangeLinks[i].first == CheckingVal)
           return true;
@@ -382,7 +382,7 @@ public:
   }
 
   /// Return number of items (ranges) stored in set.
-  unsigned getNumItems() const {
+  size_t getNumItems() const {
     return RangeLinks.size();
   }
 
@@ -409,7 +409,7 @@ public:
   ///       for range [<0>, <1>, <5>] the size will 3
   unsigned getSize() const {
     APInt sz(((const APInt&)getItem(0).getLow()).getBitWidth(), 0);
-    for (unsigned i = 0, e = getNumItems(); i != e; ++i) {
+    for (size_t i = 0, e = getNumItems(); i != e; ++i) {
       const APInt Low = getItem(i).getLow();
       const APInt High = getItem(i).getHigh();
       APInt S = High - Low + 1;

Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=186736&r1=186735&r2=186736&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Fri Jul 19 19:20:10 2013
@@ -39,7 +39,7 @@ public:
     DK_Warning,
     DK_Note
   };
-  
+
   /// DiagHandlerTy - Clients that want to handle their own diagnostics in a
   /// custom way can register a function pointer+context as a diagnostic
   /// handler.  It gets called each time PrintMessage is invoked.
@@ -98,7 +98,7 @@ public:
     return Buffers[i].Buffer;
   }
 
-  unsigned getNumBuffers() const {
+  size_t getNumBuffers() const {
     return Buffers.size();
   }
 
@@ -109,20 +109,20 @@ public:
 
   /// AddNewSourceBuffer - Add a new source buffer to this source manager.  This
   /// takes ownership of the memory buffer.
-  unsigned AddNewSourceBuffer(MemoryBuffer *F, SMLoc IncludeLoc) {
+  size_t AddNewSourceBuffer(MemoryBuffer *F, SMLoc IncludeLoc) {
     SrcBuffer NB;
     NB.Buffer = F;
     NB.IncludeLoc = IncludeLoc;
     Buffers.push_back(NB);
-    return Buffers.size()-1;
+    return Buffers.size() - 1;
   }
 
   /// AddIncludeFile - Search for a file with the specified name in the current
   /// directory or in one of the IncludeDirs.  If no file is found, this returns
   /// ~0, otherwise it returns the buffer ID of the stacked file.
   /// The full path to the included file can be found in IncludedFile.
-  unsigned AddIncludeFile(const std::string &Filename, SMLoc IncludeLoc,
-                          std::string &IncludedFile);
+  size_t AddIncludeFile(const std::string &Filename, SMLoc IncludeLoc,
+                        std::string &IncludedFile);
 
   /// FindBufferContainingLoc - Return the ID of the buffer containing the
   /// specified location, returning -1 if not found.
@@ -221,7 +221,7 @@ public:
   SMDiagnostic(StringRef filename, SourceMgr::DiagKind Knd, StringRef Msg)
     : SM(0), Filename(filename), LineNo(-1), ColumnNo(-1), Kind(Knd),
       Message(Msg) {}
-  
+
   // Diagnostic with a location.
   SMDiagnostic(const SourceMgr &sm, SMLoc L, StringRef FN,
                int Line, int Col, SourceMgr::DiagKind Kind,

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=186736&r1=186735&r2=186736&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Fri Jul 19 19:20:10 2013
@@ -52,9 +52,9 @@ SourceMgr::~SourceMgr() {
 /// AddIncludeFile - Search for a file with the specified name in the current
 /// directory or in one of the IncludeDirs.  If no file is found, this returns
 /// ~0, otherwise it returns the buffer ID of the stacked file.
-unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
-                                   SMLoc IncludeLoc,
-                                   std::string &IncludedFile) {
+size_t SourceMgr::AddIncludeFile(const std::string &Filename,
+                                 SMLoc IncludeLoc,
+                                 std::string &IncludedFile) {
   OwningPtr<MemoryBuffer> NewBuf;
   IncludedFile = Filename;
   MemoryBuffer::getFile(IncludedFile.c_str(), NewBuf);





More information about the llvm-commits mailing list