[mach-o] Refactor sections -> atoms to be table driven.
authorNick Kledzik <kledzik@apple.com>
Tue, 3 Jun 2014 23:36:50 +0000 (23:36 +0000)
committerNick Kledzik <kledzik@apple.com>
Tue, 3 Jun 2014 23:36:50 +0000 (23:36 +0000)
commitcb9f890b7710bb49c4eae1362374b6a1d184980f
treea7523c9e0a7ffa08f821ec25b49c18e2ad7f41f1
parent760520bcb78d9b91b3bbf74704d9cb3ba6b5c5b6
[mach-o] Refactor sections -> atoms to be table driven.

Previously each section kind had its own code to loop over the section and
parse it into atoms.  This refactoring has two tables.  The first maps sections
to ContentType.  The second maps ContentType to information on how to find
the atom boundaries.

A few bugs in test cases were discovered as part of the refactoring.
No change in functionality intended.

llvm-svn: 210138
lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
lld/test/mach-o/parse-compact-unwind32.yaml
lld/test/mach-o/parse-data.yaml
lld/test/mach-o/parse-function.yaml