summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/Native/ReaderNative.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-04-08 23:02:11 +0000
committerRui Ueyama <ruiu@google.com>2015-04-08 23:02:11 +0000
commitb0db07bf9049bdc028fcdd306710b86100d68a5f (patch)
tree458e64e4d774ed54456f36ad70bae1cc4109b8b2 /lld/lib/ReaderWriter/Native/ReaderNative.cpp
parent7a2e5c260c89fe40f0d65e165a83d75a34bc587e (diff)
downloadbcm5719-llvm-b0db07bf9049bdc028fcdd306710b86100d68a5f.tar.gz
bcm5719-llvm-b0db07bf9049bdc028fcdd306710b86100d68a5f.zip
Separate atom_collection type into two different types. NFC.
atom_collection is basically a wrapper for std::vector. The class provides begin and end member functions, so that it "hides" the other member functions provided by std::vector. However, you can still directly access _atoms member since the member is not protected. We cannot simply make the member private because we need that member when we are constructing atom vectors. This patch splits atom_collection into two types: std::vector<Atom *> and AtomRange. When we are constructing atom vectors, we use the former class. We return instances of the latter class from File objects so that callers cannot add or remove atoms from the lists. std::vector<Atom *> is automatically converted to AtomRange. llvm-svn: 234450
Diffstat (limited to 'lld/lib/ReaderWriter/Native/ReaderNative.cpp')
-rw-r--r--lld/lib/ReaderWriter/Native/ReaderNative.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/Native/ReaderNative.cpp b/lld/lib/ReaderWriter/Native/ReaderNative.cpp
index 0ded101f8b0..40c6057b869 100644
--- a/lld/lib/ReaderWriter/Native/ReaderNative.cpp
+++ b/lld/lib/ReaderWriter/Native/ReaderNative.cpp
@@ -407,7 +407,7 @@ private:
auto *ivar = reinterpret_cast<const IvarsT *>(base + chunk->fileOffset);
for (size_t i = 0; i < chunk->elementCount; ++i)
vec[i] = new (_alloc) AtomT(*this, ivar++);
- result._atoms = std::move(vec);
+ result = std::move(vec);
return make_error_code(NativeReaderError::success);
}
@@ -544,22 +544,22 @@ private:
for (uint32_t i=0; i < chunk->elementCount; ++i) {
const uint32_t index = targetIndexes[i];
if (index < _definedAtoms.size()) {
- this->_targetsTable[i] = _definedAtoms._atoms[index];
+ this->_targetsTable[i] = _definedAtoms[index];
continue;
}
const uint32_t undefIndex = index - _definedAtoms.size();
if (undefIndex < _undefinedAtoms.size()) {
- this->_targetsTable[i] = _undefinedAtoms._atoms[index];
+ this->_targetsTable[i] = _undefinedAtoms[index];
continue;
}
const uint32_t slIndex = undefIndex - _undefinedAtoms.size();
if (slIndex < _sharedLibraryAtoms.size()) {
- this->_targetsTable[i] = _sharedLibraryAtoms._atoms[slIndex];
+ this->_targetsTable[i] = _sharedLibraryAtoms[slIndex];
continue;
}
const uint32_t abIndex = slIndex - _sharedLibraryAtoms.size();
if (abIndex < _absoluteAtoms.size()) {
- this->_targetsTable[i] = _absoluteAtoms._atoms[abIndex];
+ this->_targetsTable[i] = _absoluteAtoms[abIndex];
continue;
}
return make_error_code(NativeReaderError::file_malformed);
@@ -718,7 +718,7 @@ inline const lld::File &NativeDefinedAtomV1::file() const {
inline uint64_t NativeDefinedAtomV1::ordinal() const {
const uint8_t* p = reinterpret_cast<const uint8_t*>(_ivarData);
auto *start = reinterpret_cast<const NativeDefinedAtomV1 *>(
- _file->_definedAtoms._atoms[0]);
+ _file->_definedAtoms[0]);
const uint8_t *startp = reinterpret_cast<const uint8_t *>(start->_ivarData);
return p - startp;
}
OpenPOWER on IntegriCloud