[cleanup] Random assortment of simple cleanups.
Pruning header includes and forward references and fixing comments.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197720 91177308-0d34-0410-b5e6-96231b3b80d8
Remove redundant 'classof' functions.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197726 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] Introduce registry and Reference kind tuple

The main changes are in:
  include/lld/Core/Reference.h
  include/lld/ReaderWriter/Reader.h
Everything else is details to support the main change.

1) Registration based Readers
Previously, lld had a tangled interdependency with all the Readers.  It would
have been impossible to make a streamlined linker (say for a JIT) which
just supported one file format and one architecture (no yaml, no archives, etc).
The old model also required a LinkingContext to read an object file, which
would have made .o inspection tools awkward.

The new model is that there is a global Registry object. You programmatically 
register the Readers you want with the registry object. Whenever you need to 
read/parse a file, you ask the registry to do it, and the registry tries each 
registered reader.

For ease of use with the existing lld code base, there is one Registry
object inside the LinkingContext object. 


2) Changing kind value to be a tuple
Beside Readers, the registry also keeps track of the mapping for Reference
Kind values to and from strings.  Along with that, this patch also fixes
an ambiguity with the previous Reference::Kind values.  The problem was that
we wanted to reuse existing relocation type values as Reference::Kind values.
But then how can the YAML write know how to convert a value to a string? The
fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace
(e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and
a 16-bit value.  This tuple system allows conversion to and from strings with 
no ambiguities.




git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197727 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] fix unused variable warning in non-debug builds

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197732 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] fix build when LLVM_HAS_VARIADIC_TEMPLATES is false

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197734 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] fix unused variable warnings

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197737 91177308-0d34-0410-b5e6-96231b3b80d8
Make SimpleFileNode inherit from FileNode.

This removes a lot of duplicated code.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197751 91177308-0d34-0410-b5e6-96231b3b80d8
Fix some typos of 'extension'.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197753 91177308-0d34-0410-b5e6-96231b3b80d8
Fix the build by adding back a comma...


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197754 91177308-0d34-0410-b5e6-96231b3b80d8
Run clang-format on r197727.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@197788 91177308-0d34-0410-b5e6-96231b3b80d8