Prune some includes from headers and sink some inline functions

MCSymbol.h shouldn't pull in MCAssembler.h, just MCFragment.h.
MCLinkerOptimizationHint.h shouldn't need MCMachObjectWriter.h.  The
rest is fixing the fallout.

llvm-svn: 273507
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 2d8ef44..d3f2aa2 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -21,6 +21,7 @@
 #include "llvm/MC/MCObjectStreamer.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/COFF.h"
+#include "llvm/Support/EndianStream.h"
 
 using namespace llvm;
 using namespace llvm::codeview;
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 47f002f..57252a0 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/EndianStream.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/LEB128.h"
 #include "llvm/Support/Path.h"
diff --git a/llvm/lib/MC/MCLinkerOptimizationHint.cpp b/llvm/lib/MC/MCLinkerOptimizationHint.cpp
index 5f6a579..9dd1439 100644
--- a/llvm/lib/MC/MCLinkerOptimizationHint.cpp
+++ b/llvm/lib/MC/MCLinkerOptimizationHint.cpp
@@ -10,6 +10,7 @@
 #include "llvm/MC/MCLinkerOptimizationHint.h"
 #include "llvm/MC/MCAsmLayout.h"
 #include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCMachObjectWriter.h"
 #include "llvm/Support/LEB128.h"
 
 using namespace llvm;
@@ -31,3 +32,28 @@
        It != EndIt; ++It)
     encodeULEB128(ObjWriter.getSymbolAddress(**It, Layout), OutStream);
 }
+
+void MCLOHDirective::emit(MachObjectWriter &ObjWriter,
+                          const MCAsmLayout &Layout) const {
+  raw_ostream &OutStream = ObjWriter.getStream();
+  emit_impl(OutStream, ObjWriter, Layout);
+}
+
+uint64_t MCLOHDirective::getEmitSize(const MachObjectWriter &ObjWriter,
+                                     const MCAsmLayout &Layout) const {
+  class raw_counting_ostream : public raw_ostream {
+    uint64_t Count;
+
+    void write_impl(const char *, size_t size) override { Count += size; }
+
+    uint64_t current_pos() const override { return Count; }
+
+  public:
+    raw_counting_ostream() : Count(0) {}
+    ~raw_counting_ostream() override { flush(); }
+  };
+
+  raw_counting_ostream OutStream;
+  emit_impl(OutStream, ObjWriter, Layout);
+  return OutStream.tell();
+}