[ObjectYAML] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 306925
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
index bda43d6..60b0ea2 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
@@ -13,9 +13,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"
-
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
 #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
@@ -24,15 +26,29 @@
 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
 #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"
 #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
 #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
-#include "llvm/DebugInfo/CodeView/EnumTables.h"
+#include "llvm/DebugInfo/CodeView/Line.h"
 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
-#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/YAMLTraits.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <tuple>
+#include <vector>
+
 using namespace llvm;
 using namespace llvm::codeview;
 using namespace llvm::CodeViewYAML;
@@ -68,21 +84,25 @@
 namespace llvm {
 namespace CodeViewYAML {
 namespace detail {
+
 struct YAMLSubsectionBase {
   explicit YAMLSubsectionBase(DebugSubsectionKind Kind) : Kind(Kind) {}
-  DebugSubsectionKind Kind;
-  virtual ~YAMLSubsectionBase() {}
+  virtual ~YAMLSubsectionBase() = default;
 
   virtual void map(IO &IO) = 0;
   virtual std::shared_ptr<DebugSubsection>
   toCodeViewSubsection(BumpPtrAllocator &Allocator,
                        const codeview::StringsAndChecksums &SC) const = 0;
+
+  DebugSubsectionKind Kind;
 };
-}
-}
-}
+
+} // end namespace detail
+} // end namespace CodeViewYAML
+} // end namespace llvm
 
 namespace {
+
 struct YAMLChecksumsSubsection : public YAMLSubsectionBase {
   YAMLChecksumsSubsection()
       : YAMLSubsectionBase(DebugSubsectionKind::FileChecksums) {}
@@ -213,7 +233,8 @@
 
   std::vector<uint32_t> RVAs;
 };
-}
+
+} // end anonymous namespace
 
 void ScalarBitSetTraits<LineFlags>::bitset(IO &io, LineFlags &Flags) {
   io.bitSetCase(Flags, "HasColumnInfo", LF_HaveColumns);
@@ -741,8 +762,9 @@
 }
 
 namespace {
+
 struct SubsectionConversionVisitor : public DebugSubsectionVisitor {
-  SubsectionConversionVisitor() {}
+  SubsectionConversionVisitor() = default;
 
   Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override;
   Error visitLines(DebugLinesSubsectionRef &Lines,
@@ -767,6 +789,8 @@
   YAMLDebugSubsection Subsection;
 };
 
+} // end anonymous namespace
+
 Error SubsectionConversionVisitor::visitUnknown(
     DebugUnknownSubsectionRef &Unknown) {
   return make_error<CodeViewError>(cv_error_code::operation_unsupported);
@@ -863,7 +887,6 @@
   Subsection.Subsection = *Result;
   return Error::success();
 }
-}
 
 Expected<YAMLDebugSubsection>
 YAMLDebugSubsection::fromCodeViewSubection(const StringsAndChecksumsRef &SC,