Use empty() instead of comparing size() with zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 13a92a9..368bd32 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -588,7 +588,7 @@
 bool Archive::isBitcodeArchive() {
   // Make sure the symTab has been loaded. In most cases this should have been
   // done when the archive was constructed, but still,  this is just in case.
-  if (!symTab.size())
+  if (symTab.empty())
     if (!loadSymbolTable(0))
       return false;
 
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 2d16230..ec71ba4 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1327,7 +1327,7 @@
     }
     
     case bitc::FUNC_CODE_INST_RET: // RET: [opty,opval<optional>]
-      if (Record.size() == 0) {
+      if (Record.empty()) {
         I = new ReturnInst();
         break;
       } else {
diff --git a/lib/Bitcode/Reader/Deserialize.cpp b/lib/Bitcode/Reader/Deserialize.cpp
index 3496d24..8455d0e 100644
--- a/lib/Bitcode/Reader/Deserialize.cpp
+++ b/lib/Bitcode/Reader/Deserialize.cpp
@@ -115,7 +115,7 @@
   if (Stream.AtEndOfStream())
     return;
   
-  assert (Record.size() == 0);
+  assert (Record.empty());
   assert (AbbrevNo >= bitc::UNABBREV_RECORD);
   RecordCode = Stream.ReadRecord(AbbrevNo,Record);
   assert (Record.size() > 0);
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 0ca10b3..16f9b89 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -646,7 +646,7 @@
             } else if (FBB) {
               if (TBB!=IBB && FBB!=IBB)   // cbr then ubr
                 continue;
-            } else if (Cond.size() == 0) {
+            } else if (Cond.empty()) {
               if (TBB!=IBB)               // ubr
                 continue;
             } else {
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 2b3bdc2..fb53377 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -237,7 +237,7 @@
 
   // Look for root nodes, i.e. blocks without successors.
   for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
-    if (I->succ_size() == 0)
+    if (I->succ_empty())
       Roots.push_back(I);
 
   std::vector<IfcvtToken*> Tokens;
@@ -428,7 +428,7 @@
 
     unsigned Size = TrueBBI.NonPredSize;
     if (TrueBBI.IsBrAnalyzable) {
-      if (TrueBBI.TrueBB && TrueBBI.BrCond.size() == 0)
+      if (TrueBBI.TrueBB && TrueBBI.BrCond.empty())
         // End with an unconditional branch. It will be removed.
         --Size;
       else {
@@ -646,7 +646,7 @@
   ScanInstructions(BBI);
 
   // Unanalyable or ends with fallthrough or unconditional branch.
-  if (!BBI.IsBrAnalyzable || BBI.BrCond.size() == 0) {
+  if (!BBI.IsBrAnalyzable || BBI.BrCond.empty()) {
     BBI.IsBeingAnalyzed = false;
     BBI.IsAnalyzed = true;
     return BBI;
diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp
index 5e6d4cb..8aa4c44 100644
--- a/lib/CodeGen/MachineModuleInfo.cpp
+++ b/lib/CodeGen/MachineModuleInfo.cpp
@@ -1784,7 +1784,7 @@
     }
 
     // Remove landing pads with no try-ranges.
-    if (!LandingPads[i].BeginLabels.size()) {
+    if (LandingPads[i].BeginLabels.empty()) {
       LandingPads.erase(LandingPads.begin() + i);
       continue;
     }
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4e835b8..5a1bf93 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -801,7 +801,7 @@
 
   // If we've change things around then replace token factor.
   if (Changed) {
-    if (Ops.size() == 0) {
+    if (Ops.empty()) {
       // The entry token is the only possible outcome.
       Result = DAG.getEntryNode();
     } else {
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 250298e..293d023 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -230,7 +230,7 @@
 void ScheduleDAG::CalculateDepths() {
   std::vector<std::pair<SUnit*, unsigned> > WorkList;
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i)
-    if (SUnits[i].Preds.size() == 0)
+    if (SUnits[i].Preds.empty())
       WorkList.push_back(std::make_pair(&SUnits[i], 0U));
 
   while (!WorkList.empty()) {
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
index 5c7422c..42d54f6 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
@@ -169,7 +169,7 @@
   // All leaves to Available queue.
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
     // It is available if it has no predecessors.
-    if (SUnits[i].Preds.size() == 0 && &SUnits[i] != Entry) {
+    if (SUnits[i].Preds.empty() && &SUnits[i] != Entry) {
       AvailableQueue->push(&SUnits[i]);
       SUnits[i].isAvailable = SUnits[i].isPending = true;
     }
@@ -477,7 +477,7 @@
   std::vector<std::pair<const SUnit*, unsigned> > WorkList;
   for (unsigned i = 0, e = SUnits->size(); i != e; ++i) {
     const SUnit *SU = &(*SUnits)[i];
-    if (SU->Succs.size() == 0)
+    if (SU->Succs.empty())
       WorkList.push_back(std::make_pair(SU, 0U));
   }
 
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 48bc3cd..8681844 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -898,7 +898,7 @@
   // All leaves to Available queue.
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
     // It is available if it has no predecessors.
-    if (SUnits[i].Preds.size() == 0 && &SUnits[i] != Entry) {
+    if (SUnits[i].Preds.empty() && &SUnits[i] != Entry) {
       AvailableQueue->push(&SUnits[i]);
       SUnits[i].isAvailable = true;
     }
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ad6cd1b..a61bd81 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3497,7 +3497,7 @@
 bool SDNode::hasAnyUseOfValue(unsigned Value) const {
   assert(Value < getNumValues() && "Bad value!");
 
-  if (use_size() == 0) return false;
+  if (use_empty()) return false;
 
   SDOperand TheValue(const_cast<SDNode *>(this), Value);
 
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index bebbf83..b5f623d 100644
--- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -257,7 +257,7 @@
 
 // double drand48()
 GenericValue lle_X_drand48(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.DoubleVal = drand48();
   return GV;
@@ -265,7 +265,7 @@
 
 // long lrand48()
 GenericValue lle_X_lrand48(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.IntVal = APInt(32, lrand48());
   return GV;
@@ -282,7 +282,7 @@
 
 // int rand()
 GenericValue lle_X_rand(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.IntVal = APInt(32, rand());
   return GV;
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc
index 8c6f3a8..ff5cc0a 100644
--- a/lib/System/Win32/Path.inc
+++ b/lib/System/Win32/Path.inc
@@ -418,7 +418,7 @@
 
 bool
 Path::set(const std::string& a_path) {
-  if (a_path.size() == 0)
+  if (a_path.empty())
     return false;
   std::string save(path);
   path = a_path;
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index 1f2a1b0..f5252a0 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -740,7 +740,7 @@
     
     // If the constant string's length is zero we can optimize this by just
     // doing a store of 0 at the first byte of the destination
-    if (SrcStr.size() == 0) {
+    if (SrcStr.empty()) {
       new StoreInst(ConstantInt::get(Type::Int8Ty, 0), Dst, CI);
       return ReplaceCallWith(CI, Dst);
     }
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 1521c5f..33bfbf0 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -476,7 +476,7 @@
       while (isa<PHINode>(InsertPt)) ++InsertPt;
       ExitBlocks[0]->getInstList().insert(InsertPt, &I);
     }
-  } else if (ExitBlocks.size() == 0) {
+  } else if (ExitBlocks.empty()) {
     // The instruction is actually dead if there ARE NO exit blocks.
     CurAST->deleteValue(&I);
     if (!I.use_empty())  // If I has users in unreachable blocks, eliminate.
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 7ce4711..5d80b75 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1214,7 +1214,7 @@
                                                       Loop *L,
                                                       bool isOnlyStride) {
   // If all the users are moved to another stride, then there is nothing to do.
-  if (Uses.Users.size() == 0)
+  if (Uses.Users.empty())
     return;
 
   // Keep track if every use in UsersToProcess is an address. If they all are,
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 9bc1018..b0fd3d6 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -722,7 +722,7 @@
       
       ++NumFactor;
       
-      if (Ops.size() == 0)
+      if (Ops.empty())
         return V2;
 
       // Add the new value to the list of things being added.