Add empty() to atom_collection.
"x.empty()" is more idiomatic than "x.size() == 0". This patch is to add such method and use it in LLD. Differential Revision: http://llvm-reviews.chandlerc.com/D3279 llvm-svn: 205558
This commit is contained in:
parent
275542a40e
commit
4469ce6c7b
|
@ -105,6 +105,7 @@ public:
|
||||||
virtual const T *deref(const void *it) const = 0;
|
virtual const T *deref(const void *it) const = 0;
|
||||||
virtual void next(const void *&it) const = 0;
|
virtual void next(const void *&it) const = 0;
|
||||||
virtual uint64_t size() const = 0;
|
virtual uint64_t size() const = 0;
|
||||||
|
bool empty() const { return size() == 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief The class is the iterator type used to iterate through a File's
|
/// \brief The class is the iterator type used to iterate through a File's
|
||||||
|
|
|
@ -78,7 +78,7 @@ void Resolver::handleFile(const File &file) {
|
||||||
|
|
||||||
if (!sharedLibraryFile ||
|
if (!sharedLibraryFile ||
|
||||||
_context.addUndefinedAtomsFromSharedLibrary(sharedLibraryFile)) {
|
_context.addUndefinedAtomsFromSharedLibrary(sharedLibraryFile)) {
|
||||||
progress = (file.undefined().size() > 0);
|
progress = !file.undefined().empty();
|
||||||
|
|
||||||
for (const UndefinedAtom *undefAtom : file.undefined()) {
|
for (const UndefinedAtom *undefAtom : file.undefined()) {
|
||||||
doUndefinedAtom(*undefAtom);
|
doUndefinedAtom(*undefAtom);
|
||||||
|
@ -101,8 +101,8 @@ void Resolver::handleFile(const File &file) {
|
||||||
|
|
||||||
// If we make some progress on linking, notify that fact to the input file
|
// If we make some progress on linking, notify that fact to the input file
|
||||||
// manager, because it may want to know that for --start-group/end-group.
|
// manager, because it may want to know that for --start-group/end-group.
|
||||||
progress = progress || file.sharedLibrary().size() ||
|
progress = progress || !file.sharedLibrary().empty() ||
|
||||||
file.absolute().size() || file.defined().size();
|
!file.absolute().empty() || !file.defined().empty();
|
||||||
if (progress) {
|
if (progress) {
|
||||||
_context.inputGraph().notifyProgress();
|
_context.inputGraph().notifyProgress();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ std::vector<ImportTableEntryAtom *> ImportDirectoryAtom::createImportTableAtoms(
|
||||||
} // namespace idata
|
} // namespace idata
|
||||||
|
|
||||||
void IdataPass::perform(std::unique_ptr<MutableFile> &file) {
|
void IdataPass::perform(std::unique_ptr<MutableFile> &file) {
|
||||||
if (file->sharedLibrary().size() == 0)
|
if (file->sharedLibrary().empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
idata::Context context(*file, _dummyFile);
|
idata::Context context(*file, _dummyFile);
|
||||||
|
|
Loading…
Reference in New Issue