diff --git a/lld/lib/Driver/InputGraph.cpp b/lld/lib/Driver/InputGraph.cpp index be7fea0c18cb..3f464618c9bf 100644 --- a/lld/lib/Driver/InputGraph.cpp +++ b/lld/lib/Driver/InputGraph.cpp @@ -133,7 +133,7 @@ uint32_t ControlNode::getResolveState() const { /// \brief Set the resolve state for the current element /// thats processed by the resolver. void ControlNode::setResolveState(uint32_t resolveState) { - if (_elements.size() == 0) + if (_elements.empty()) return; _elements[_currentElementIndex]->setResolveState(resolveState); } @@ -151,7 +151,7 @@ SimpleFileNode::SimpleFileNode(StringRef path, int64_t ordinal) /// of the input elements contained in the group. ErrorOr Group::getNextFile() { // 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); for (;;) { diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 9f692c1942b5..35cf6dd10d0f 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -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"; return false; } diff --git a/lld/lib/ReaderWriter/ELF/SectionChunks.h b/lld/lib/ReaderWriter/ELF/SectionChunks.h index 0a0663ba8826..cc0ce1687c2e 100644 --- a/lld/lib/ReaderWriter/ELF/SectionChunks.h +++ b/lld/lib/ReaderWriter/ELF/SectionChunks.h @@ -575,8 +575,7 @@ StringTable::StringTable(const ELFLinkingContext &context, } template uint64_t StringTable::addString(StringRef symname) { - - if (symname.size() == 0) + if (symname.empty()) return 0; StringMapTIter stringIter = _stringMap.find(symname); if (stringIter == _stringMap.end()) { diff --git a/lld/lib/ReaderWriter/MachO/StubsPass.hpp b/lld/lib/ReaderWriter/MachO/StubsPass.hpp index a478b9e9794b..83afd7b1f1a4 100644 --- a/lld/lib/ReaderWriter/MachO/StubsPass.hpp +++ b/lld/lib/ReaderWriter/MachO/StubsPass.hpp @@ -123,7 +123,7 @@ public: virtual void addStubAtoms(MutableFile &mergedFile) { // Exit early if no stubs needed. - if ( _targetToStub.size() == 0 ) + if (_targetToStub.empty()) return; // Add all stubs to master file. for (auto it : _targetToStub) { diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index 9d7bbca89d6b..40bf988a9873 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -666,7 +666,7 @@ private: array = array.slice(3); } - if (array.size() == 0) + if (array.empty()) return ""; size_t len = 0;