[llvm] r175501 - Simplify code. No functionality change.

Jakub Staszak kubastaszak at gmail.com
Tue Feb 19 01:48:30 PST 2013


Author: kuba
Date: Tue Feb 19 03:48:30 2013
New Revision: 175501

URL: http://llvm.org/viewvc/llvm-project?rev=175501&view=rev
Log:
Simplify code. No functionality change.

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp?rev=175501&r1=175500&r2=175501&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp Tue Feb 19 03:48:30 2013
@@ -26,34 +26,28 @@ void BitstreamCursor::operator=(const Bi
 
   // Copy abbreviations, and bump ref counts.
   CurAbbrevs = RHS.CurAbbrevs;
-  for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
-       i != e; ++i)
+  for (size_t i = 0, e = CurAbbrevs.size(); i != e; ++i)
     CurAbbrevs[i]->addRef();
 
   // Copy block scope and bump ref counts.
   BlockScope = RHS.BlockScope;
-  for (unsigned S = 0, e = static_cast<unsigned>(BlockScope.size());
-       S != e; ++S) {
+  for (size_t S = 0, e = BlockScope.size(); S != e; ++S) {
     std::vector<BitCodeAbbrev*> &Abbrevs = BlockScope[S].PrevAbbrevs;
-    for (unsigned i = 0, e = static_cast<unsigned>(Abbrevs.size());
-         i != e; ++i)
+    for (size_t i = 0, e = Abbrevs.size(); i != e; ++i)
       Abbrevs[i]->addRef();
   }
 }
 
 void BitstreamCursor::freeState() {
   // Free all the Abbrevs.
-  for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
-       i != e; ++i)
+  for (size_t i = 0, e = CurAbbrevs.size(); i != e; ++i)
     CurAbbrevs[i]->dropRef();
   CurAbbrevs.clear();
 
   // Free all the Abbrevs in the block scope.
-  for (unsigned S = 0, e = static_cast<unsigned>(BlockScope.size());
-       S != e; ++S) {
+  for (size_t S = 0, e = BlockScope.size(); S != e; ++S) {
     std::vector<BitCodeAbbrev*> &Abbrevs = BlockScope[S].PrevAbbrevs;
-    for (unsigned i = 0, e = static_cast<unsigned>(Abbrevs.size());
-         i != e; ++i)
+    for (size_t i = 0, e = Abbrevs.size(); i != e; ++i)
       Abbrevs[i]->dropRef();
   }
   BlockScope.clear();
@@ -69,8 +63,7 @@ bool BitstreamCursor::EnterSubBlock(unsi
   // Add the abbrevs specific to this block to the CurAbbrevs list.
   if (const BitstreamReader::BlockInfo *Info =
       BitStream->getBlockInfo(BlockID)) {
-    for (unsigned i = 0, e = static_cast<unsigned>(Info->Abbrevs.size());
-         i != e; ++i) {
+    for (size_t i = 0, e = Info->Abbrevs.size(); i != e; ++i) {
       CurAbbrevs.push_back(Info->Abbrevs[i]);
       CurAbbrevs.back()->addRef();
     }





More information about the llvm-commits mailing list