diff options
| author | Nick Kledzik <kledzik@apple.com> | 2012-02-07 02:59:54 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2012-02-07 02:59:54 +0000 |
| commit | 23384e84afd9e7a53cf2c802829f505cef2754c2 (patch) | |
| tree | 363052290c18a83f3bb54871e9533d7f21aaeb14 /lld/tools/lld-core/lld-core.cpp | |
| parent | e55c556a247a9c0decb4e256d9e897dfc9cf841d (diff) | |
| download | bcm5719-llvm-23384e84afd9e7a53cf2c802829f505cef2754c2.tar.gz bcm5719-llvm-23384e84afd9e7a53cf2c802829f505cef2754c2.zip | |
Add support for UndefinedAtom in yaml and native format. Add test cases with undefined atoms
llvm-svn: 149962
Diffstat (limited to 'lld/tools/lld-core/lld-core.cpp')
| -rw-r--r-- | lld/tools/lld-core/lld-core.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lld/tools/lld-core/lld-core.cpp b/lld/tools/lld-core/lld-core.cpp index 96744a2d819..152eb9529e9 100644 --- a/lld/tools/lld-core/lld-core.cpp +++ b/lld/tools/lld-core/lld-core.cpp @@ -172,20 +172,19 @@ public: virtual bool forEachAtom(File::AtomHandler &handler) const { handler.doFile(*this); + // visit defined atoms for (std::vector<const Atom *>::iterator it = _atoms.begin(); it != _atoms.end(); ++it) { - const Atom* atom = *it; - switch ( atom->definition() ) { - case Atom::definitionRegular: - handler.doDefinedAtom(*(DefinedAtom*)atom); - break; - case Atom::definitionUndefined: - handler.doUndefinedAtom(*(UndefinedAtom*)atom); - break; - default: - // TO DO - break; - } + const DefinedAtom* atom = (*it)->definedAtom(); + if ( atom ) + handler.doDefinedAtom(*atom); + } + // visit undefined atoms + for (std::vector<const Atom *>::iterator it = _atoms.begin(); + it != _atoms.end(); ++it) { + const UndefinedAtom* atom = (*it)->undefinedAtom(); + if ( atom ) + handler.doUndefinedAtom(*atom); } return true; } @@ -198,7 +197,8 @@ public: private: std::vector<const Atom *> &_atoms; }; -} +} //anonymous namespace + int main(int argc, const char *argv[]) { // Print a stack trace if we signal out. @@ -220,7 +220,7 @@ int main(int argc, const char *argv[]) { // write new atom graph out as YAML doc std::string errorInfo; llvm::raw_fd_ostream out("-", errorInfo); -// yaml::writeObjectText(outFile, out); + //yaml::writeObjectText(outFile, out); // make unique temp .o file to put generated object file int fd; @@ -233,7 +233,7 @@ int main(int argc, const char *argv[]) { binaryOut.close(); // manually close so that file can be read next // read native file - lld::File* natFile; + llvm::OwningPtr<lld::File> natFile; parseNativeObjectFileOrSTDIN(tempPath, natFile); // write new atom graph out as YAML doc @@ -242,6 +242,6 @@ int main(int argc, const char *argv[]) { // delete temp .o file bool existed; llvm::sys::fs::remove(tempPath.str(), existed); - + return 0; } |

