r226914 - Replace size() calls on containers with empty() calls where appropriate. NFC
Alexander Kornienko
alexfh at google.com
Fri Jan 23 07:36:11 PST 2015
Author: alexfh
Date: Fri Jan 23 09:36:10 2015
New Revision: 226914
URL: http://llvm.org/viewvc/llvm-project?rev=226914&view=rev
Log:
Replace size() calls on containers with empty() calls where appropriate. NFC
http://reviews.llvm.org/D7090
Patch by Gábor Horváth!
Modified:
cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
cfe/trunk/utils/TableGen/NeonEmitter.cpp
Modified: cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp (original)
+++ cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp Fri Jan 23 09:36:10 2015
@@ -55,7 +55,7 @@ protected:
return false;
}
}
- if (args.size() && args[0] == "help")
+ if (!args.empty() && args[0] == "help")
PrintHelp(llvm::errs());
return true;
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Jan 23 09:36:10 2015
@@ -432,7 +432,7 @@ TargetMachine *EmitAssemblyHelper::Creat
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(),
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Fri Jan 23 09:36:10 2015
@@ -2366,7 +2366,7 @@ llvm::Function *CGObjCGNU::ModuleInitFun
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);
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Jan 23 09:36:10 2015
@@ -6945,7 +6945,7 @@ CXTUResourceUsage clang_getCXTUResourceU
CXTUResourceUsage usage = { (void*) entries.get(),
(unsigned) entries->size(),
- entries->size() ? &(*entries)[0] : nullptr };
+ !entries->empty() ? &(*entries)[0] : nullptr };
entries.release();
return usage;
}
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri Jan 23 09:36:10 2015
@@ -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(
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 == ";
Modified: cfe/trunk/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/NeonEmitter.cpp?rev=226914&r1=226913&r2=226914&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/NeonEmitter.cpp Fri Jan 23 09:36:10 2015
@@ -1393,7 +1393,7 @@ void Intrinsic::emitBody(StringRef CallP
}
}
- assert(Lines.size() && "Empty def?");
+ assert(!Lines.empty() && "Empty def?");
if (!RetVar.getType().isVoid())
Lines.back().insert(0, RetVar.getName() + " = ");
More information about the cfe-commits
mailing list