]> granicus.if.org Git - clang/commitdiff
Replace size() calls on containers with empty() calls where appropriate. NFC
authorAlexander Kornienko <alexfh@google.com>
Fri, 23 Jan 2015 15:36:10 +0000 (15:36 +0000)
committerAlexander Kornienko <alexfh@google.com>
Fri, 23 Jan 2015 15:36:10 +0000 (15:36 +0000)
http://reviews.llvm.org/D7090

Patch by Gábor Horváth!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226914 91177308-0d34-0410-b5e6-96231b3b80d8

examples/PrintFunctionNames/PrintFunctionNames.cpp
lib/CodeGen/BackendUtil.cpp
lib/CodeGen/CGObjCGNU.cpp
tools/libclang/CIndex.cpp
utils/TableGen/ClangAttrEmitter.cpp
utils/TableGen/NeonEmitter.cpp

index e8a361dbee9a2bd26c70e70f997f01cedf8d2a1c..b554caeb2a2a0d163743056edbcd2942f2c5e57c 100644 (file)
@@ -55,7 +55,7 @@ protected:
         return false;
       }
     }
-    if (args.size() && args[0] == "help")
+    if (!args.empty() && args[0] == "help")
       PrintHelp(llvm::errs());
 
     return true;
index ec93bc80af36b6d90adcd855b95345cf23c86f3e..ead6bd62a6b15f998fb64e7b45d6a9eed1238bce 100644 (file)
@@ -432,7 +432,7 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
                                     BackendArgs.data());
 
   std::string FeaturesStr;
-  if (TargetOpts.Features.size()) {
+  if (!TargetOpts.Features.empty()) {
     SubtargetFeatures Features;
     for (std::vector<std::string>::const_iterator
            it = TargetOpts.Features.begin(),
index c0dc3b8002d8afff43c108f6e01bfd0eb1888e10..da952601233ce9fbd645754982774dd52dbdb0c5 100644 (file)
@@ -2366,7 +2366,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
   std::vector<llvm::Constant*> Elements;
   llvm::Constant *Statics = NULLPtr;
   // Generate statics list:
-  if (ConstantStrings.size()) {
+  if (!ConstantStrings.empty()) {
     llvm::ArrayType *StaticsArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
         ConstantStrings.size() + 1);
     ConstantStrings.push_back(NULLPtr);
index 2625ae1fdcebbbeb83fd82e4ce8ebe0f10bb6cb4..b8e44a2124c7fc48c8c06989c3b27542c84f0907 100644 (file)
@@ -6945,7 +6945,7 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
 
   CXTUResourceUsage usage = { (void*) entries.get(),
                             (unsigned) entries->size(),
-                            entries->size() ? &(*entries)[0] : nullptr };
+                            !entries->empty() ? &(*entries)[0] : nullptr };
   entries.release();
   return usage;
 }
index a73be2e0815b0db07391762690b6b55fb005a404..83629ec3605100d30359857798e5446adf356499 100644 (file)
@@ -1207,7 +1207,7 @@ writePrettyPrintFunction(Record &R,
 static unsigned
 getSpellingListIndex(const std::vector<FlattenedSpelling> &SpellingList,
                      const FlattenedSpelling &Spelling) {
-  assert(SpellingList.size() && "Spelling list is empty!");
+  assert(!SpellingList.empty() && "Spelling list is empty!");
 
   for (unsigned Index = 0; Index < SpellingList.size(); ++Index) {
     const FlattenedSpelling &S = SpellingList[Index];
@@ -1231,7 +1231,7 @@ static void writeAttrAccessorDefinition(const Record &R, raw_ostream &OS) {
     std::vector<FlattenedSpelling> Spellings = 
       GetFlattenedSpellings(*Accessor);
     std::vector<FlattenedSpelling> SpellingList = GetFlattenedSpellings(R);
-    assert(SpellingList.size() &&
+    assert(!SpellingList.empty() &&
            "Attribute with empty spelling list can't have accessors!");
 
     OS << "  bool " << Name << "() const { return SpellingListIndex == ";
index a8e8e394194e59523d22f14bfd61e0c35b6a0d69..d243672119e8916f2bd051dedad9a93711af10d3 100644 (file)
@@ -1393,7 +1393,7 @@ void Intrinsic::emitBody(StringRef CallPrefix) {
     }
   }
 
-  assert(Lines.size() && "Empty def?");
+  assert(!Lines.empty() && "Empty def?");
   if (!RetVar.getType().isVoid())
     Lines.back().insert(0, RetVar.getName() + " = ");