diff options
| author | Nick Kledzik <kledzik@apple.com> | 2011-12-21 23:29:36 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2011-12-21 23:29:36 +0000 |
| commit | f46669c828648cc08a75649ec97298fd90ac9586 (patch) | |
| tree | 80de4c7041acd716f561359bfa7be4b959747a99 /lld/lib/Core | |
| parent | 7869d8c01e746e3cecfef2925a5ad799a03830b3 (diff) | |
| download | bcm5719-llvm-f46669c828648cc08a75649ec97298fd90ac9586.tar.gz bcm5719-llvm-f46669c828648cc08a75649ec97298fd90ac9586.zip | |
Cleaned up Atom attribues some more. Added lots of doxygen comments
llvm-svn: 147105
Diffstat (limited to 'lld/lib/Core')
| -rw-r--r-- | lld/lib/Core/Atom.cpp | 11 | ||||
| -rw-r--r-- | lld/lib/Core/File.cpp | 5 | ||||
| -rw-r--r-- | lld/lib/Core/Resolver.cpp | 4 | ||||
| -rw-r--r-- | lld/lib/Core/YamlReader.cpp | 46 |
4 files changed, 32 insertions, 34 deletions
diff --git a/lld/lib/Core/Atom.cpp b/lld/lib/Core/Atom.cpp index 889ec096e32..29aa1c805fa 100644 --- a/lld/lib/Core/Atom.cpp +++ b/lld/lib/Core/Atom.cpp @@ -16,10 +16,6 @@ namespace lld { Atom::~Atom() {} - bool Atom::translationUnitSource(llvm::StringRef &path) const { - return false; - } - llvm::StringRef Atom::name() const { return llvm::StringRef(); } @@ -44,12 +40,5 @@ namespace lld { return 0; } - Atom::UnwindInfo::iterator Atom::beginUnwind() const{ - return 0; - } - - Atom::UnwindInfo::iterator Atom::endUnwind() const{ - return 0; - } } // namespace lld diff --git a/lld/lib/Core/File.cpp b/lld/lib/Core/File.cpp index e123d5ec192..09c3f8aba7b 100644 --- a/lld/lib/Core/File.cpp +++ b/lld/lib/Core/File.cpp @@ -13,4 +13,9 @@ namespace lld { File::~File() {} +bool File::translationUnitSource(llvm::StringRef &path) const { + return false; +} + + } diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index b3be26bf188..c3b83756e1b 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -183,14 +183,14 @@ void Resolver::updateReferences() { void Resolver::markLive(const Atom &atom, WhyLiveBackChain *previous) { // if -why_live cares about this symbol, then dump chain if ((previous->referer != NULL) && _platform.printWhyLive(atom.name())) { - llvm::errs() << atom.name() << " from " << atom.file()->path() << "\n"; + llvm::errs() << atom.name() << " from " << atom.file().path() << "\n"; int depth = 1; for (WhyLiveBackChain *p = previous; p != NULL; p = p->previous, ++depth) { for (int i = depth; i > 0; --i) llvm::errs() << " "; llvm::errs() << p->referer->name() << " from " - << p->referer->file()->path() << "\n"; + << p->referer->file().path() << "\n"; } } diff --git a/lld/lib/Core/YamlReader.cpp b/lld/lib/Core/YamlReader.cpp index c95e061931c..6250939b8a7 100644 --- a/lld/lib/Core/YamlReader.cpp +++ b/lld/lib/Core/YamlReader.cpp @@ -238,7 +238,8 @@ bool YAMLFile::justInTimeforEachAtom(llvm::StringRef name, class YAMLAtom : public Atom { public: - YAMLAtom( Definition d + YAMLAtom( uint64_t ord + , Definition d , Scope s , ContentType ct , SectionChoice sc @@ -247,18 +248,18 @@ public: , bool tb , bool al , Alignment a - , YAMLFile *f + , YAMLFile& f , const char *n) - : Atom(d, s, ct, sc, intn, dsk, tb, al, a) + : Atom(ord, d, s, ct, sc, intn, dsk, tb, al, a) , _file(f) , _name(n) , _size(0) - , _refStartIndex(f->_lastRefIndex) - , _refEndIndex(f->_references.size()) { - f->_lastRefIndex = _refEndIndex; + , _refStartIndex(f._lastRefIndex) + , _refEndIndex(f._references.size()) { + f._lastRefIndex = _refEndIndex; } - virtual const class File *file() const { + virtual const class File& file() const { return _file; } @@ -282,7 +283,7 @@ public: virtual Reference::iterator referencesBegin() const; virtual Reference::iterator referencesEnd() const; private: - YAMLFile *_file; + YAMLFile& _file; const char *_name; unsigned long _size; unsigned int _refStartIndex; @@ -290,14 +291,14 @@ private: }; Reference::iterator YAMLAtom::referencesBegin() const { - if (_file->_references.size() < _refStartIndex) - return (Reference::iterator)&_file->_references[_refStartIndex]; + if (_file._references.size() < _refStartIndex) + return (Reference::iterator)&_file._references[_refStartIndex]; return 0; } Reference::iterator YAMLAtom::referencesEnd() const { - if (_file->_references.size() < _refEndIndex) - return (Reference::iterator)&_file->_references[_refEndIndex]; + if (_file._references.size() < _refEndIndex) + return (Reference::iterator)&_file._references[_refEndIndex]; return 0; } @@ -316,9 +317,10 @@ public: void setFixupTarget(const char *n); void addFixup(YAMLFile *f); - void makeAtom(YAMLFile *); + void makeAtom(YAMLFile&); private: + uint64_t _ordinal; const char *_name; Atom::Alignment _align; Atom::ContentType _type; @@ -334,7 +336,8 @@ private: }; YAMLAtomState::YAMLAtomState() - : _name(NULL) + : _ordinal(0) + , _name(NULL) , _align(0, 0) , _type(Atom::typeData) , _scope(Atom::scopeGlobal) @@ -349,13 +352,14 @@ YAMLAtomState::YAMLAtomState() _ref.flags = 0; } -void YAMLAtomState::makeAtom(YAMLFile *f) { - Atom *a = new YAMLAtom(_def, _scope, _type, _sectionChoice, +void YAMLAtomState::makeAtom(YAMLFile& f) { + Atom *a = new YAMLAtom(_ordinal, _def, _scope, _type, _sectionChoice, _internalName, _dontDeadStrip, _thumb, _alias, _align, f, _name); - f->_atoms.push_back(a); - + f._atoms.push_back(a); + ++_ordinal; + // reset state for next atom _name = NULL; _align.powerOf2 = 0; @@ -472,7 +476,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb if (entry->beginDocument) { if (file != NULL) { if (haveAtom) { - atomState.makeAtom(file); + atomState.makeAtom(*file); haveAtom = false; } result.push_back(file); @@ -502,7 +506,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb if (depthForAtoms == entry->depth) { if (entry->beginSequence) { if (haveAtom) { - atomState.makeAtom(file); + atomState.makeAtom(*file); haveAtom = false; } } @@ -546,7 +550,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb lastDepth = entry->depth; } if (haveAtom) { - atomState.makeAtom(file); + atomState.makeAtom(*file); } result.push_back(file); |

