Use empty() instead of size() == 0.

llvm-svn: 194551
This commit is contained in:
Rui Ueyama 2013-11-13 03:09:20 +00:00
parent 12f390856c
commit 2235bff2b9
6 changed files with 7 additions and 7 deletions

View File

@ -227,7 +227,7 @@ void Resolver::doDefinedAtom(const DefinedAtom &atom) {
switch ( atom.sectionPosition() ) { switch ( atom.sectionPosition() ) {
case DefinedAtom::sectionPositionStart: case DefinedAtom::sectionPositionStart:
case DefinedAtom::sectionPositionEnd: case DefinedAtom::sectionPositionEnd:
assert(atom.size() == 0); assert(atom.empty());
break; break;
case DefinedAtom::sectionPositionEarly: case DefinedAtom::sectionPositionEarly:
case DefinedAtom::sectionPositionAny: case DefinedAtom::sectionPositionAny:

View File

@ -133,7 +133,7 @@ uint32_t ControlNode::getResolveState() const {
/// \brief Set the resolve state for the current element /// \brief Set the resolve state for the current element
/// thats processed by the resolver. /// thats processed by the resolver.
void ControlNode::setResolveState(uint32_t resolveState) { void ControlNode::setResolveState(uint32_t resolveState) {
if (_elements.size() == 0) if (_elements.empty())
return; return;
_elements[_currentElementIndex]->setResolveState(resolveState); _elements[_currentElementIndex]->setResolveState(resolveState);
} }
@ -151,7 +151,7 @@ SimpleFileNode::SimpleFileNode(StringRef path, int64_t ordinal)
/// of the input elements contained in the group. /// of the input elements contained in the group.
ErrorOr<File &> Group::getNextFile() { ErrorOr<File &> Group::getNextFile() {
// If there are no elements, move on to the next input element // If there are no elements, move on to the next input element
if (_elements.size() == 0) if (_elements.empty())
return make_error_code(InputGraphError::no_more_files); return make_error_code(InputGraphError::no_more_files);
for (;;) { for (;;) {

View File

@ -911,7 +911,7 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
} }
} }
if (inputElements.size() == 0 && !isReadingDirectiveSection) { if (inputElements.empty() && !isReadingDirectiveSection) {
diagnostics << "No input files\n"; diagnostics << "No input files\n";
return false; return false;
} }

View File

@ -576,7 +576,7 @@ StringTable<ELFT>::StringTable(const ELFLinkingContext &context,
template <class ELFT> uint64_t StringTable<ELFT>::addString(StringRef symname) { template <class ELFT> uint64_t StringTable<ELFT>::addString(StringRef symname) {
if (symname.size() == 0) if (symname.empty())
return 0; return 0;
StringMapTIter stringIter = _stringMap.find(symname); StringMapTIter stringIter = _stringMap.find(symname);
if (stringIter == _stringMap.end()) { if (stringIter == _stringMap.end()) {

View File

@ -123,7 +123,7 @@ public:
virtual void addStubAtoms(MutableFile &mergedFile) { virtual void addStubAtoms(MutableFile &mergedFile) {
// Exit early if no stubs needed. // Exit early if no stubs needed.
if ( _targetToStub.size() == 0 ) if (_targetToStub.empty())
return; return;
// Add all stubs to master file. // Add all stubs to master file.
for (auto it : _targetToStub) { for (auto it : _targetToStub) {

View File

@ -666,7 +666,7 @@ private:
array = array.slice(3); array = array.slice(3);
} }
if (array.size() == 0) if (array.empty())
return ""; return "";
size_t len = 0; size_t len = 0;