Update prebuilt Clang to r416183b from Android.

https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef

clang 12.0.5 (based on r416183b) from build 7284624.

Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
index 0ac8b65..3867d78 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
@@ -38,7 +38,7 @@
   explicit AppendingTypeTableBuilder(BumpPtrAllocator &Storage);
   ~AppendingTypeTableBuilder();
 
-  // TypeTableCollection overrides
+  // TypeCollection overrides
   Optional<TypeIndex> getFirst() override;
   Optional<TypeIndex> getNext(TypeIndex Prev) override;
   CVType getType(TypeIndex Index) override;
@@ -46,6 +46,7 @@
   bool contains(TypeIndex Index) override;
   uint32_t size() override;
   uint32_t capacity() override;
+  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
 
   // public interface
   void reset();
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVRecord.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVRecord.h
index 784c47e..bb29ef5 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVRecord.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVRecord.h
@@ -11,9 +11,9 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/Endian.h"
@@ -61,12 +61,9 @@
   ArrayRef<uint8_t> RecordData;
 };
 
-template <typename Kind> struct RemappedRecord {
-  explicit RemappedRecord(const CVRecord<Kind> &R) : OriginalRecord(R) {}
-
-  CVRecord<Kind> OriginalRecord;
-  SmallVector<std::pair<uint32_t, TypeIndex>, 8> Mappings;
-};
+// There are two kinds of codeview records: type and symbol records.
+using CVType = CVRecord<TypeLeafKind>;
+using CVSymbol = CVRecord<SymbolKind>;
 
 template <typename Record, typename Func>
 Error forEachCodeViewRecord(ArrayRef<uint8_t> StreamBuffer, Func F) {
@@ -126,6 +123,12 @@
   }
 };
 
+namespace codeview {
+using CVSymbolArray = VarStreamArray<CVSymbol>;
+using CVTypeArray = VarStreamArray<CVType>;
+using CVTypeRange = iterator_range<CVTypeArray::Iterator>;
+} // namespace codeview
+
 } // end namespace llvm
 
 #endif // LLVM_DEBUGINFO_CODEVIEW_RECORDITERATOR_H
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
index 1615ff4..82ef8c1 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
@@ -10,9 +10,6 @@
 #define LLVM_DEBUGINFO_CODEVIEW_CVSYMBOLVISITOR_H
 
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h"
 #include "llvm/Support/ErrorOr.h"
 
 namespace llvm {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
index 7d20bb0..7538cb2 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
@@ -11,7 +11,6 @@
 
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -31,9 +30,6 @@
 Error visitTypeRecord(CVType &Record, TypeIndex Index,
                       TypeVisitorCallbacks &Callbacks,
                       VisitorDataSource Source = VDS_BytesPresent);
-Error visitTypeRecord(CVType &Record, TypeIndex Index,
-                      TypeVisitorCallbackPipeline &Callbacks,
-                      VisitorDataSource Source = VDS_BytesPresent);
 Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
                       VisitorDataSource Source = VDS_BytesPresent);
 
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
index d3bad4c..d851dea 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
@@ -15,7 +15,8 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/GUID.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/BinaryStreamWriter.h"
 #include "llvm/Support/Error.h"
@@ -29,9 +30,13 @@
 
 class CodeViewRecordStreamer {
 public:
-  virtual void EmitBytes(StringRef Data) = 0;
-  virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0;
-  virtual void EmitBinaryData(StringRef Data) = 0;
+  virtual void emitBytes(StringRef Data) = 0;
+  virtual void emitIntValue(uint64_t Value, unsigned Size) = 0;
+  virtual void emitBinaryData(StringRef Data) = 0;
+  virtual void AddComment(const Twine &T) = 0;
+  virtual void AddRawComment(const Twine &T) = 0;
+  virtual bool isVerboseAsm() = 0;
+  virtual std::string getTypeName(TypeIndex TI) = 0;
   virtual ~CodeViewRecordStreamer() = default;
 };
 
@@ -59,7 +64,7 @@
   Error beginRecord(Optional<uint32_t> MaxLength);
   Error endRecord();
 
-  Error mapInteger(TypeIndex &TypeInd);
+  Error mapInteger(TypeIndex &TypeInd, const Twine &Comment = "");
 
   bool isStreaming() const {
     return (Streamer != nullptr) && (Reader == nullptr) && (Writer == nullptr);
@@ -77,7 +82,7 @@
     if (isStreaming()) {
       StringRef BytesSR =
           StringRef((reinterpret_cast<const char *>(&Value)), sizeof(Value));
-      Streamer->EmitBytes(BytesSR);
+      Streamer->emitBytes(BytesSR);
       incrStreamedLen(sizeof(T));
       return Error::success();
     }
@@ -92,9 +97,10 @@
     return Error::success();
   }
 
-  template <typename T> Error mapInteger(T &Value) {
+  template <typename T> Error mapInteger(T &Value, const Twine &Comment = "") {
     if (isStreaming()) {
-      Streamer->EmitIntValue((int)Value, sizeof(T));
+      emitComment(Comment);
+      Streamer->emitIntValue((int)Value, sizeof(T));
       incrStreamedLen(sizeof(T));
       return Error::success();
     }
@@ -105,17 +111,17 @@
     return Reader->readInteger(Value);
   }
 
-  template <typename T> Error mapEnum(T &Value) {
+  template <typename T> Error mapEnum(T &Value, const Twine &Comment = "") {
     if (!isStreaming() && sizeof(Value) > maxFieldLength())
       return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
 
-    using U = typename std::underlying_type<T>::type;
+    using U = std::underlying_type_t<T>;
     U X;
 
     if (isWriting() || isStreaming())
       X = static_cast<U>(Value);
 
-    if (auto EC = mapInteger(X))
+    if (auto EC = mapInteger(X, Comment))
       return EC;
 
     if (isReading())
@@ -124,20 +130,23 @@
     return Error::success();
   }
 
-  Error mapEncodedInteger(int64_t &Value);
-  Error mapEncodedInteger(uint64_t &Value);
-  Error mapEncodedInteger(APSInt &Value);
-  Error mapStringZ(StringRef &Value);
-  Error mapGuid(GUID &Guid);
+  Error mapEncodedInteger(int64_t &Value, const Twine &Comment = "");
+  Error mapEncodedInteger(uint64_t &Value, const Twine &Comment = "");
+  Error mapEncodedInteger(APSInt &Value, const Twine &Comment = "");
+  Error mapStringZ(StringRef &Value, const Twine &Comment = "");
+  Error mapGuid(GUID &Guid, const Twine &Comment = "");
 
-  Error mapStringZVectorZ(std::vector<StringRef> &Value);
+  Error mapStringZVectorZ(std::vector<StringRef> &Value,
+                          const Twine &Comment = "");
 
   template <typename SizeType, typename T, typename ElementMapper>
-  Error mapVectorN(T &Items, const ElementMapper &Mapper) {
+  Error mapVectorN(T &Items, const ElementMapper &Mapper,
+                   const Twine &Comment = "") {
     SizeType Size;
     if (isStreaming()) {
       Size = static_cast<SizeType>(Items.size());
-      Streamer->EmitIntValue(Size, sizeof(Size));
+      emitComment(Comment);
+      Streamer->emitIntValue(Size, sizeof(Size));
       incrStreamedLen(sizeof(Size)); // add 1 for the delimiter
 
       for (auto &X : Items) {
@@ -168,7 +177,9 @@
   }
 
   template <typename T, typename ElementMapper>
-  Error mapVectorTail(T &Items, const ElementMapper &Mapper) {
+  Error mapVectorTail(T &Items, const ElementMapper &Mapper,
+                      const Twine &Comment = "") {
+    emitComment(Comment);
     if (isStreaming() || isWriting()) {
       for (auto &Item : Items) {
         if (auto EC = Mapper(*this, Item))
@@ -186,8 +197,9 @@
     return Error::success();
   }
 
-  Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes);
-  Error mapByteVectorTail(std::vector<uint8_t> &Bytes);
+  Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes, const Twine &Comment = "");
+  Error mapByteVectorTail(std::vector<uint8_t> &Bytes,
+                          const Twine &Comment = "");
 
   Error padToAlignment(uint32_t Align);
   Error skipPadding();
@@ -198,9 +210,16 @@
     return 0;
   }
 
+  void emitRawComment(const Twine &T) {
+    if (isStreaming() && Streamer->isVerboseAsm())
+      Streamer->AddRawComment(T);
+  }
+
 private:
-  void emitEncodedSignedInteger(const int64_t &Value);
-  void emitEncodedUnsignedInteger(const uint64_t &Value);
+  void emitEncodedSignedInteger(const int64_t &Value,
+                                const Twine &Comment = "");
+  void emitEncodedUnsignedInteger(const uint64_t &Value,
+                                  const Twine &Comment = "");
   Error writeEncodedSignedInteger(const int64_t &Value);
   Error writeEncodedUnsignedInteger(const uint64_t &Value);
 
@@ -214,6 +233,14 @@
       StreamedLen = 4; // The record prefix is 4 bytes long
   }
 
+  void emitComment(const Twine &Comment) {
+    if (isStreaming() && Streamer->isVerboseAsm()) {
+      Twine TComment(Comment);
+      if (!TComment.isTriviallyEmpty())
+        Streamer->AddComment(TComment);
+    }
+  }
+
   struct RecordLimit {
     uint32_t BeginOffset;
     Optional<uint32_t> MaxLength;
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRegisters.def b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRegisters.def
index 9767e49..48ea7e5 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRegisters.def
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/CodeViewRegisters.def
@@ -15,6 +15,7 @@
 #endif
 
 #if !defined(CV_REGISTERS_ALL) && !defined(CV_REGISTERS_X86) &&                \
+    !defined(CV_REGISTERS_ARM) &&                                              \
     !defined(CV_REGISTERS_ARM64)
 #error Need include at least one register set.
 #endif
@@ -366,8 +367,167 @@
 
 #endif // defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_X86)
 
+#if defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM)
+
+// ARM registers
+
+CV_REGISTER(ARM_NOREG, 0)
+
+// General purpose 32-bit integer regisers
+
+CV_REGISTER(ARM_R0, 10)
+CV_REGISTER(ARM_R1, 11)
+CV_REGISTER(ARM_R2, 12)
+CV_REGISTER(ARM_R3, 13)
+CV_REGISTER(ARM_R4, 14)
+CV_REGISTER(ARM_R5, 15)
+CV_REGISTER(ARM_R6, 16)
+CV_REGISTER(ARM_R7, 17)
+CV_REGISTER(ARM_R8, 18)
+CV_REGISTER(ARM_R9, 19)
+CV_REGISTER(ARM_R10, 20)
+CV_REGISTER(ARM_R11, 21)
+CV_REGISTER(ARM_R12, 22)
+CV_REGISTER(ARM_SP, 23)
+CV_REGISTER(ARM_LR, 24)
+CV_REGISTER(ARM_PC, 25)
+
+// Status register
+
+CV_REGISTER(ARM_CPSR, 26)
+
+// ARM VFPv1 registers
+
+CV_REGISTER(ARM_FPSCR, 40)
+CV_REGISTER(ARM_FPEXC, 41)
+
+CV_REGISTER(ARM_FS0, 50)
+CV_REGISTER(ARM_FS1, 51)
+CV_REGISTER(ARM_FS2, 52)
+CV_REGISTER(ARM_FS3, 53)
+CV_REGISTER(ARM_FS4, 54)
+CV_REGISTER(ARM_FS5, 55)
+CV_REGISTER(ARM_FS6, 56)
+CV_REGISTER(ARM_FS7, 57)
+CV_REGISTER(ARM_FS8, 58)
+CV_REGISTER(ARM_FS9, 59)
+CV_REGISTER(ARM_FS10, 60)
+CV_REGISTER(ARM_FS11, 61)
+CV_REGISTER(ARM_FS12, 62)
+CV_REGISTER(ARM_FS13, 63)
+CV_REGISTER(ARM_FS14, 64)
+CV_REGISTER(ARM_FS15, 65)
+CV_REGISTER(ARM_FS16, 66)
+CV_REGISTER(ARM_FS17, 67)
+CV_REGISTER(ARM_FS18, 68)
+CV_REGISTER(ARM_FS19, 69)
+CV_REGISTER(ARM_FS20, 70)
+CV_REGISTER(ARM_FS21, 71)
+CV_REGISTER(ARM_FS22, 72)
+CV_REGISTER(ARM_FS23, 73)
+CV_REGISTER(ARM_FS24, 74)
+CV_REGISTER(ARM_FS25, 75)
+CV_REGISTER(ARM_FS26, 76)
+CV_REGISTER(ARM_FS27, 77)
+CV_REGISTER(ARM_FS28, 78)
+CV_REGISTER(ARM_FS29, 79)
+CV_REGISTER(ARM_FS30, 80)
+CV_REGISTER(ARM_FS31, 81)
+
+// ARM VFPv3/NEON registers
+
+CV_REGISTER(ARM_FS32, 200)
+CV_REGISTER(ARM_FS33, 201)
+CV_REGISTER(ARM_FS34, 202)
+CV_REGISTER(ARM_FS35, 203)
+CV_REGISTER(ARM_FS36, 204)
+CV_REGISTER(ARM_FS37, 205)
+CV_REGISTER(ARM_FS38, 206)
+CV_REGISTER(ARM_FS39, 207)
+CV_REGISTER(ARM_FS40, 208)
+CV_REGISTER(ARM_FS41, 209)
+CV_REGISTER(ARM_FS42, 210)
+CV_REGISTER(ARM_FS43, 211)
+CV_REGISTER(ARM_FS44, 212)
+CV_REGISTER(ARM_FS45, 213)
+CV_REGISTER(ARM_FS46, 214)
+CV_REGISTER(ARM_FS47, 215)
+CV_REGISTER(ARM_FS48, 216)
+CV_REGISTER(ARM_FS49, 217)
+CV_REGISTER(ARM_FS50, 218)
+CV_REGISTER(ARM_FS51, 219)
+CV_REGISTER(ARM_FS52, 220)
+CV_REGISTER(ARM_FS53, 221)
+CV_REGISTER(ARM_FS54, 222)
+CV_REGISTER(ARM_FS55, 223)
+CV_REGISTER(ARM_FS56, 224)
+CV_REGISTER(ARM_FS57, 225)
+CV_REGISTER(ARM_FS58, 226)
+CV_REGISTER(ARM_FS59, 227)
+CV_REGISTER(ARM_FS60, 228)
+CV_REGISTER(ARM_FS61, 229)
+CV_REGISTER(ARM_FS62, 230)
+CV_REGISTER(ARM_FS63, 231)
+
+CV_REGISTER(ARM_ND0, 300)
+CV_REGISTER(ARM_ND1, 301)
+CV_REGISTER(ARM_ND2, 302)
+CV_REGISTER(ARM_ND3, 303)
+CV_REGISTER(ARM_ND4, 304)
+CV_REGISTER(ARM_ND5, 305)
+CV_REGISTER(ARM_ND6, 306)
+CV_REGISTER(ARM_ND7, 307)
+CV_REGISTER(ARM_ND8, 308)
+CV_REGISTER(ARM_ND9, 309)
+CV_REGISTER(ARM_ND10, 310)
+CV_REGISTER(ARM_ND11, 311)
+CV_REGISTER(ARM_ND12, 312)
+CV_REGISTER(ARM_ND13, 313)
+CV_REGISTER(ARM_ND14, 314)
+CV_REGISTER(ARM_ND15, 315)
+CV_REGISTER(ARM_ND16, 316)
+CV_REGISTER(ARM_ND17, 317)
+CV_REGISTER(ARM_ND18, 318)
+CV_REGISTER(ARM_ND19, 319)
+CV_REGISTER(ARM_ND20, 320)
+CV_REGISTER(ARM_ND21, 321)
+CV_REGISTER(ARM_ND22, 322)
+CV_REGISTER(ARM_ND23, 323)
+CV_REGISTER(ARM_ND24, 324)
+CV_REGISTER(ARM_ND25, 325)
+CV_REGISTER(ARM_ND26, 326)
+CV_REGISTER(ARM_ND27, 327)
+CV_REGISTER(ARM_ND28, 328)
+CV_REGISTER(ARM_ND29, 329)
+CV_REGISTER(ARM_ND30, 330)
+CV_REGISTER(ARM_ND31, 331)
+
+CV_REGISTER(ARM_NQ0, 400)
+CV_REGISTER(ARM_NQ1, 401)
+CV_REGISTER(ARM_NQ2, 402)
+CV_REGISTER(ARM_NQ3, 403)
+CV_REGISTER(ARM_NQ4, 404)
+CV_REGISTER(ARM_NQ5, 405)
+CV_REGISTER(ARM_NQ6, 406)
+CV_REGISTER(ARM_NQ7, 407)
+CV_REGISTER(ARM_NQ8, 408)
+CV_REGISTER(ARM_NQ9, 409)
+CV_REGISTER(ARM_NQ10, 410)
+CV_REGISTER(ARM_NQ11, 411)
+CV_REGISTER(ARM_NQ12, 412)
+CV_REGISTER(ARM_NQ13, 413)
+CV_REGISTER(ARM_NQ14, 414)
+CV_REGISTER(ARM_NQ15, 415)
+
+#endif // defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM)
+
 #if defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM64)
 
+// arm64intr.h from MSVC defines ARM64_FPSR, which conflicts with
+// these declarations.
+#pragma push_macro("ARM64_FPSR")
+#undef ARM64_FPSR
+
 // ARM64 registers
 
 CV_REGISTER(ARM64_NOREG, 0)
@@ -556,4 +716,6 @@
 
 CV_REGISTER(ARM64_FPSR, 220)
 
+#pragma pop_macro("ARM64_FPSR")
+
 #endif // defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM64)
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index cd67f78..0e2f5d9 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -18,7 +18,6 @@
 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/Support/Allocator.h"
 #include "llvm/Support/BinaryByteStream.h"
 #include "llvm/Support/BinaryStreamWriter.h"
 #include "llvm/Support/Error.h"
@@ -61,4 +60,4 @@
 } // namespace codeview
 } // namespace llvm
 
-#endif
\ No newline at end of file
+#endif
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
index bcb379f..e915d8a 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
@@ -35,44 +35,38 @@
 class DebugSubsectionRecord {
 public:
   DebugSubsectionRecord();
-  DebugSubsectionRecord(DebugSubsectionKind Kind, BinaryStreamRef Data,
-                        CodeViewContainer Container);
+  DebugSubsectionRecord(DebugSubsectionKind Kind, BinaryStreamRef Data);
 
-  static Error initialize(BinaryStreamRef Stream, DebugSubsectionRecord &Info,
-                          CodeViewContainer Container);
+  static Error initialize(BinaryStreamRef Stream, DebugSubsectionRecord &Info);
 
   uint32_t getRecordLength() const;
   DebugSubsectionKind kind() const;
   BinaryStreamRef getRecordData() const;
 
 private:
-  CodeViewContainer Container = CodeViewContainer::ObjectFile;
   DebugSubsectionKind Kind = DebugSubsectionKind::None;
   BinaryStreamRef Data;
 };
 
 class DebugSubsectionRecordBuilder {
 public:
-  DebugSubsectionRecordBuilder(std::shared_ptr<DebugSubsection> Subsection,
-                               CodeViewContainer Container);
+  DebugSubsectionRecordBuilder(std::shared_ptr<DebugSubsection> Subsection);
 
   /// Use this to copy existing subsections directly from source to destination.
   /// For example, line table subsections in an object file only need to be
   /// relocated before being copied into the PDB.
-  DebugSubsectionRecordBuilder(const DebugSubsectionRecord &Contents,
-                               CodeViewContainer Container);
+  DebugSubsectionRecordBuilder(const DebugSubsectionRecord &Contents);
 
-  uint32_t calculateSerializedLength();
-  Error commit(BinaryStreamWriter &Writer) const;
+  uint32_t calculateSerializedLength() const;
+  Error commit(BinaryStreamWriter &Writer, CodeViewContainer Container) const;
 
 private:
   /// The subsection to build. Will be null if Contents is non-empty.
   std::shared_ptr<DebugSubsection> Subsection;
 
   /// The bytes of the subsection. Only non-empty if Subsection is null.
+  /// FIXME: Reduce the size of this.
   DebugSubsectionRecord Contents;
-
-  CodeViewContainer Container;
 };
 
 } // end namespace codeview
@@ -83,8 +77,7 @@
     // FIXME: We need to pass the container type through to this function.  In
     // practice this isn't super important since the subsection header describes
     // its length and we can just skip it.  It's more important when writing.
-    if (auto EC = codeview::DebugSubsectionRecord::initialize(
-            Stream, Info, codeview::CodeViewContainer::Pdb))
+    if (auto EC = codeview::DebugSubsectionRecord::initialize(Stream, Info))
       return EC;
     Length = alignTo(Info.getRecordLength(), 4);
     return Error::success();
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
index 720b1b4..624a623 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
@@ -10,10 +10,8 @@
 #define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
 
 #include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
 #include "llvm/Support/Error.h"
-#include <cstdint>
 
 namespace llvm {
 
@@ -30,7 +28,6 @@
 class DebugSymbolRVASubsectionRef;
 class DebugSymbolsSubsectionRef;
 class DebugUnknownSubsectionRef;
-class StringsAndChecksumsRef;
 
 class DebugSubsectionVisitor {
 public:
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
index 784fc59..51b8523 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
 
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/EnumTables.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/EnumTables.h
index ed126ed..270cd4b 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/EnumTables.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/EnumTables.h
@@ -37,6 +37,17 @@
 ArrayRef<EnumEntry<uint16_t>> getTrampolineNames();
 ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
 getImageSectionCharacteristicNames();
+ArrayRef<EnumEntry<uint16_t>> getClassOptionNames();
+ArrayRef<EnumEntry<uint8_t>> getMemberAccessNames();
+ArrayRef<EnumEntry<uint16_t>> getMethodOptionNames();
+ArrayRef<EnumEntry<uint16_t>> getMemberKindNames();
+ArrayRef<EnumEntry<uint8_t>> getPtrKindNames();
+ArrayRef<EnumEntry<uint8_t>> getPtrModeNames();
+ArrayRef<EnumEntry<uint16_t>> getPtrMemberRepNames();
+ArrayRef<EnumEntry<uint16_t>> getTypeModifierNames();
+ArrayRef<EnumEntry<uint8_t>> getCallingConventions();
+ArrayRef<EnumEntry<uint8_t>> getFunctionOptionEnum();
+ArrayRef<EnumEntry<uint16_t>> getLabelTypeEnum();
 
 } // end namespace codeview
 } // end namespace llvm
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
index a43ce20..8c22eaf 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
@@ -43,14 +43,14 @@
   /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
   SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
 
-  /// Contains a list of all hash values inexed by TypeIndex.toArrayIndex().
+  /// Contains a list of all hash values indexed by TypeIndex.toArrayIndex().
   SmallVector<GloballyHashedType, 2> SeenHashes;
 
 public:
   explicit GlobalTypeTableBuilder(BumpPtrAllocator &Storage);
   ~GlobalTypeTableBuilder();
 
-  // TypeTableCollection overrides
+  // TypeCollection overrides
   Optional<TypeIndex> getFirst() override;
   Optional<TypeIndex> getNext(TypeIndex Prev) override;
   CVType getType(TypeIndex Index) override;
@@ -58,6 +58,7 @@
   bool contains(TypeIndex Index) override;
   uint32_t size() override;
   uint32_t capacity() override;
+  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
 
   // public interface
   void reset();
@@ -71,6 +72,11 @@
   template <typename CreateFunc>
   TypeIndex insertRecordAs(GloballyHashedType Hash, size_t RecordSize,
                            CreateFunc Create) {
+    assert(RecordSize < UINT32_MAX && "Record too big");
+    assert(RecordSize % 4 == 0 &&
+           "RecordSize is not a multiple of 4 bytes which will cause "
+           "misalignment in the output TPI stream!");
+
     auto Result = HashedRecords.try_emplace(Hash, nextTypeIndex());
 
     if (LLVM_UNLIKELY(Result.second /*inserted*/ ||
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
index 4e03627..ddbb4e3 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h
@@ -14,7 +14,6 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/Error.h"
@@ -79,6 +78,7 @@
   uint32_t capacity() override;
   Optional<TypeIndex> getFirst() override;
   Optional<TypeIndex> getNext(TypeIndex Prev) override;
+  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
 
 private:
   Error ensureTypeExists(TypeIndex Index);
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
index 1b2f6d2..2f3d7a9 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
@@ -47,7 +47,7 @@
   explicit MergingTypeTableBuilder(BumpPtrAllocator &Storage);
   ~MergingTypeTableBuilder();
 
-  // TypeTableCollection overrides
+  // TypeCollection overrides
   Optional<TypeIndex> getFirst() override;
   Optional<TypeIndex> getNext(TypeIndex Prev) override;
   CVType getType(TypeIndex Index) override;
@@ -55,6 +55,7 @@
   bool contains(TypeIndex Index) override;
   uint32_t size() override;
   uint32_t capacity() override;
+  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
 
   // public interface
   void reset();
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/RecordName.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/RecordName.h
index cc09db8..8e06be9 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/RecordName.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/RecordName.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_RECORDNAME_H
 #define LLVM_DEBUGINFO_CODEVIEW_RECORDNAME_H
 
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index 3ca09b4..fcc0452 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -10,25 +10,11 @@
 #define LLVM_DEBUGINFO_CODEVIEW_SIMPLETYPESERIALIZER_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/BinaryByteStream.h"
-#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/Error.h"
-#include <cassert>
-#include <cstdint>
-#include <memory>
 #include <vector>
 
 namespace llvm {
 namespace codeview {
+class FieldListRecord;
 
 class SimpleTypeSerializer {
   std::vector<uint8_t> ScratchBuffer;
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
index 62761cb..108abb2 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
@@ -62,7 +62,7 @@
 
   Error visitSymbolBegin(CVSymbol &Record) override {
     assert(!Mapping && "Already in a symbol mapping!");
-    Mapping = llvm::make_unique<MappingInfo>(Record.content(), Container);
+    Mapping = std::make_unique<MappingInfo>(Record.content(), Container);
     return Mapping->Mapping.visitSymbolBegin(Record);
   }
   Error visitSymbolEnd(CVSymbol &Record) override {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDumper.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDumper.h
index d832a48..aaeffb2 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDumper.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolDumper.h
@@ -11,8 +11,8 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 
 namespace llvm {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 5e9a743..c37f6b4 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -73,17 +73,17 @@
   Thunk32Sym(SymbolRecordKind Kind, uint32_t RecordOffset)
       : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
 
-  uint32_t Parent;
-  uint32_t End;
-  uint32_t Next;
-  uint32_t Offset;
-  uint16_t Segment;
-  uint16_t Length;
-  ThunkOrdinal Thunk;
+  uint32_t Parent = 0;
+  uint32_t End = 0;
+  uint32_t Next = 0;
+  uint32_t Offset = 0;
+  uint16_t Segment = 0;
+  uint16_t Length = 0;
+  ThunkOrdinal Thunk = ThunkOrdinal::Standard;
   StringRef Name;
   ArrayRef<uint8_t> VariantData;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_TRAMPOLINE
@@ -94,13 +94,13 @@
       : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
 
   TrampolineType Type;
-  uint16_t Size;
-  uint32_t ThunkOffset;
-  uint32_t TargetOffset;
-  uint16_t ThunkSection;
-  uint16_t TargetSection;
+  uint16_t Size = 0;
+  uint32_t ThunkOffset = 0;
+  uint32_t TargetOffset = 0;
+  uint16_t ThunkSection = 0;
+  uint16_t TargetSection = 0;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_SECTION
@@ -110,14 +110,14 @@
   SectionSym(SymbolRecordKind Kind, uint32_t RecordOffset)
       : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
 
-  uint16_t SectionNumber;
-  uint8_t Alignment;
-  uint32_t Rva;
-  uint32_t Length;
-  uint32_t Characteristics;
+  uint16_t SectionNumber = 0;
+  uint8_t Alignment = 0;
+  uint32_t Rva = 0;
+  uint32_t Length = 0;
+  uint32_t Characteristics = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_COFFGROUP
@@ -127,13 +127,13 @@
   CoffGroupSym(SymbolRecordKind Kind, uint32_t RecordOffset)
       : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
 
-  uint32_t Size;
-  uint32_t Characteristics;
-  uint32_t Offset;
-  uint16_t Segment;
+  uint32_t Size = 0;
+  uint32_t Characteristics = 0;
+  uint32_t Offset = 0;
+  uint16_t Segment = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 class ScopeEndSym : public SymbolRecord {
@@ -142,7 +142,7 @@
   ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
       : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 class CallerSym : public SymbolRecord {
@@ -153,13 +153,13 @@
 
   std::vector<TypeIndex> Indices;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 struct DecodedAnnotation {
   StringRef Name;
   ArrayRef<uint8_t> Bytes;
-  BinaryAnnotationsOpCode OpCode;
+  BinaryAnnotationsOpCode OpCode = BinaryAnnotationsOpCode::Invalid;
   uint32_t U1 = 0;
   uint32_t U2 = 0;
   int32_t S1 = 0;
@@ -333,7 +333,7 @@
 class InlineSiteSym : public SymbolRecord {
 public:
   explicit InlineSiteSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  InlineSiteSym(uint32_t RecordOffset)
+  explicit InlineSiteSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::InlineSiteSym),
         RecordOffset(RecordOffset) {}
 
@@ -342,12 +342,19 @@
                       BinaryAnnotationIterator());
   }
 
-  uint32_t Parent;
-  uint32_t End;
+  uint32_t Parent = 0;
+  uint32_t End = 0;
   TypeIndex Inlinee;
   std::vector<uint8_t> AnnotationData;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
+};
+
+struct PublicSym32Header {
+  ulittle32_t Flags;
+  ulittle32_t Offset;
+  ulittle16_t Segment;
+  // char Name[];
 };
 
 // S_PUB32
@@ -371,7 +378,7 @@
 class RegisterSym : public SymbolRecord {
 public:
   explicit RegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  RegisterSym(uint32_t RecordOffset)
+  explicit RegisterSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::RegisterSym),
         RecordOffset(RecordOffset) {}
 
@@ -379,7 +386,7 @@
   RegisterId Register;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_PROCREF, S_LPROCREF
@@ -390,13 +397,13 @@
       : SymbolRecord(SymbolRecordKind::ProcRefSym), RecordOffset(RecordOffset) {
   }
 
-  uint32_t SumName;
-  uint32_t SymOffset;
-  uint16_t Module;
+  uint32_t SumName = 0;
+  uint32_t SymOffset = 0;
+  uint16_t Module = 0;
   StringRef Name;
 
   uint16_t modi() const { return Module - 1; }
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_LOCAL
@@ -407,21 +414,21 @@
       : SymbolRecord(SymbolRecordKind::LocalSym), RecordOffset(RecordOffset) {}
 
   TypeIndex Type;
-  LocalSymFlags Flags;
+  LocalSymFlags Flags = LocalSymFlags::None;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 struct LocalVariableAddrRange {
-  uint32_t OffsetStart;
-  uint16_t ISectStart;
-  uint16_t Range;
+  uint32_t OffsetStart = 0;
+  uint16_t ISectStart = 0;
+  uint16_t Range = 0;
 };
 
 struct LocalVariableAddrGap {
-  uint16_t GapStartOffset;
-  uint16_t Range;
+  uint16_t GapStartOffset = 0;
+  uint16_t Range = 0;
 };
 
 enum : uint16_t { MaxDefRange = 0xf000 };
@@ -440,11 +447,11 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t Program;
+  uint32_t Program = 0;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_DEFRANGE_SUBFIELD
@@ -453,7 +460,7 @@
 
 public:
   explicit DefRangeSubfieldSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  DefRangeSubfieldSym(uint32_t RecordOffset)
+  explicit DefRangeSubfieldSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DefRangeSubfieldSym),
         RecordOffset(RecordOffset) {}
 
@@ -461,58 +468,62 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t Program;
-  uint16_t OffsetInParent;
+  uint32_t Program = 0;
+  uint16_t OffsetInParent = 0;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
+};
+
+struct DefRangeRegisterHeader {
+  ulittle16_t Register;
+  ulittle16_t MayHaveNoName;
 };
 
 // S_DEFRANGE_REGISTER
 class DefRangeRegisterSym : public SymbolRecord {
 public:
-  struct Header {
-    ulittle16_t Register;
-    ulittle16_t MayHaveNoName;
-  };
-
   explicit DefRangeRegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  DefRangeRegisterSym(uint32_t RecordOffset)
+  explicit DefRangeRegisterSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DefRangeRegisterSym),
         RecordOffset(RecordOffset) {}
 
-  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
+  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(DefRangeRegisterHeader); }
 
-  Header Hdr;
+  DefRangeRegisterHeader Hdr;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
+};
+
+struct DefRangeSubfieldRegisterHeader {
+  ulittle16_t Register;
+  ulittle16_t MayHaveNoName;
+  ulittle32_t OffsetInParent;
 };
 
 // S_DEFRANGE_SUBFIELD_REGISTER
 class DefRangeSubfieldRegisterSym : public SymbolRecord {
 public:
-  struct Header {
-    ulittle16_t Register;
-    ulittle16_t MayHaveNoName;
-    ulittle32_t OffsetInParent;
-  };
-
   explicit DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
       : SymbolRecord(Kind) {}
-  DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
+  explicit DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DefRangeSubfieldRegisterSym),
         RecordOffset(RecordOffset) {}
 
-  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
+  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(DefRangeSubfieldRegisterHeader); }
 
-  Header Hdr;
+  DefRangeSubfieldRegisterHeader Hdr;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
+};
+
+struct DefRangeFramePointerRelHeader {
+  little32_t Offset;
 };
 
 // S_DEFRANGE_FRAMEPOINTER_REL
@@ -522,7 +533,7 @@
 public:
   explicit DefRangeFramePointerRelSym(SymbolRecordKind Kind)
       : SymbolRecord(Kind) {}
-  DefRangeFramePointerRelSym(uint32_t RecordOffset)
+  explicit DefRangeFramePointerRelSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelSym),
         RecordOffset(RecordOffset) {}
 
@@ -530,22 +541,22 @@
     return RecordOffset + RelocationOffset;
   }
 
-  int32_t Offset;
+  DefRangeFramePointerRelHeader Hdr;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
+};
+
+struct DefRangeRegisterRelHeader {
+  ulittle16_t Register;
+  ulittle16_t Flags;
+  little32_t BasePointerOffset;
 };
 
 // S_DEFRANGE_REGISTER_REL
 class DefRangeRegisterRelSym : public SymbolRecord {
 public:
-  struct Header {
-    ulittle16_t Register;
-    ulittle16_t Flags;
-    little32_t BasePointerOffset;
-  };
-
   explicit DefRangeRegisterRelSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
   explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DefRangeRegisterRelSym),
@@ -563,13 +574,13 @@
   bool hasSpilledUDTMember() const { return Hdr.Flags & IsSubfieldFlag; }
   uint16_t offsetInParent() const { return Hdr.Flags >> OffsetInParentShift; }
 
-  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
+  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(DefRangeRegisterRelHeader); }
 
-  Header Hdr;
+  DefRangeRegisterRelHeader Hdr;
   LocalVariableAddrRange Range;
   std::vector<LocalVariableAddrGap> Gaps;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE
@@ -581,9 +592,9 @@
       : SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelFullScopeSym),
         RecordOffset(RecordOffset) {}
 
-  int32_t Offset;
+  int32_t Offset = 0;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_BLOCK32
@@ -599,14 +610,14 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t Parent;
-  uint32_t End;
-  uint32_t CodeSize;
-  uint32_t CodeOffset;
-  uint16_t Segment;
+  uint32_t Parent = 0;
+  uint32_t End = 0;
+  uint32_t CodeSize = 0;
+  uint32_t CodeOffset = 0;
+  uint16_t Segment = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_LABEL32
@@ -622,12 +633,12 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t CodeOffset;
-  uint16_t Segment;
-  ProcSymFlags Flags;
+  uint32_t CodeOffset = 0;
+  uint16_t Segment = 0;
+  ProcSymFlags Flags = ProcSymFlags::None;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_OBJNAME
@@ -635,82 +646,82 @@
 public:
   explicit ObjNameSym() : SymbolRecord(SymbolRecordKind::ObjNameSym) {}
   explicit ObjNameSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  ObjNameSym(uint32_t RecordOffset)
+  explicit ObjNameSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::ObjNameSym), RecordOffset(RecordOffset) {
   }
 
-  uint32_t Signature;
+  uint32_t Signature = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_ENVBLOCK
 class EnvBlockSym : public SymbolRecord {
 public:
   explicit EnvBlockSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  EnvBlockSym(uint32_t RecordOffset)
+  explicit EnvBlockSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::EnvBlockSym),
         RecordOffset(RecordOffset) {}
 
   std::vector<StringRef> Fields;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_EXPORT
 class ExportSym : public SymbolRecord {
 public:
   explicit ExportSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  ExportSym(uint32_t RecordOffset)
+  explicit ExportSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::ExportSym), RecordOffset(RecordOffset) {}
 
-  uint16_t Ordinal;
-  ExportFlags Flags;
+  uint16_t Ordinal = 0;
+  ExportFlags Flags = ExportFlags::None;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_FILESTATIC
 class FileStaticSym : public SymbolRecord {
 public:
   explicit FileStaticSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  FileStaticSym(uint32_t RecordOffset)
+  explicit FileStaticSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::FileStaticSym),
         RecordOffset(RecordOffset) {}
 
   TypeIndex Index;
-  uint32_t ModFilenameOffset;
-  LocalSymFlags Flags;
+  uint32_t ModFilenameOffset = 0;
+  LocalSymFlags Flags = LocalSymFlags::None;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_COMPILE2
 class Compile2Sym : public SymbolRecord {
 public:
   explicit Compile2Sym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  Compile2Sym(uint32_t RecordOffset)
+  explicit Compile2Sym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::Compile2Sym),
         RecordOffset(RecordOffset) {}
 
-  CompileSym2Flags Flags;
+  CompileSym2Flags Flags = CompileSym2Flags::None;
   CPUType Machine;
-  uint16_t VersionFrontendMajor;
-  uint16_t VersionFrontendMinor;
-  uint16_t VersionFrontendBuild;
-  uint16_t VersionBackendMajor;
-  uint16_t VersionBackendMinor;
-  uint16_t VersionBackendBuild;
+  uint16_t VersionFrontendMajor = 0;
+  uint16_t VersionFrontendMinor = 0;
+  uint16_t VersionFrontendBuild = 0;
+  uint16_t VersionBackendMajor = 0;
+  uint16_t VersionBackendMinor = 0;
+  uint16_t VersionBackendBuild = 0;
   StringRef Version;
   std::vector<StringRef> ExtraStrings;
 
   uint8_t getLanguage() const { return static_cast<uint32_t>(Flags) & 0xFF; }
   uint32_t getFlags() const { return static_cast<uint32_t>(Flags) & ~0xFF; }
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_COMPILE3
@@ -718,20 +729,20 @@
 public:
   Compile3Sym() : SymbolRecord(SymbolRecordKind::Compile3Sym) {}
   explicit Compile3Sym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  Compile3Sym(uint32_t RecordOffset)
+  explicit Compile3Sym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::Compile3Sym),
         RecordOffset(RecordOffset) {}
 
-  CompileSym3Flags Flags;
+  CompileSym3Flags Flags = CompileSym3Flags::None;
   CPUType Machine;
-  uint16_t VersionFrontendMajor;
-  uint16_t VersionFrontendMinor;
-  uint16_t VersionFrontendBuild;
-  uint16_t VersionFrontendQFE;
-  uint16_t VersionBackendMajor;
-  uint16_t VersionBackendMinor;
-  uint16_t VersionBackendBuild;
-  uint16_t VersionBackendQFE;
+  uint16_t VersionFrontendMajor = 0;
+  uint16_t VersionFrontendMinor = 0;
+  uint16_t VersionFrontendBuild = 0;
+  uint16_t VersionFrontendQFE = 0;
+  uint16_t VersionBackendMajor = 0;
+  uint16_t VersionBackendMinor = 0;
+  uint16_t VersionBackendBuild = 0;
+  uint16_t VersionBackendQFE = 0;
   StringRef Version;
 
   void setLanguage(SourceLanguage Lang) {
@@ -750,7 +761,7 @@
            (getFlags() & (CompileSym3Flags::PGO | CompileSym3Flags::LTCG));
   }
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_FRAMEPROC
@@ -761,13 +772,13 @@
       : SymbolRecord(SymbolRecordKind::FrameProcSym),
         RecordOffset(RecordOffset) {}
 
-  uint32_t TotalFrameBytes;
-  uint32_t PaddingFrameBytes;
-  uint32_t OffsetToPadding;
-  uint32_t BytesOfCalleeSavedRegisters;
-  uint32_t OffsetOfExceptionHandler;
-  uint16_t SectionIdOfExceptionHandler;
-  FrameProcedureOptions Flags;
+  uint32_t TotalFrameBytes = 0;
+  uint32_t PaddingFrameBytes = 0;
+  uint32_t OffsetToPadding = 0;
+  uint32_t BytesOfCalleeSavedRegisters = 0;
+  uint32_t OffsetOfExceptionHandler = 0;
+  uint16_t SectionIdOfExceptionHandler = 0;
+  FrameProcedureOptions Flags = FrameProcedureOptions::None;
 
   /// Extract the register this frame uses to refer to local variables.
   RegisterId getLocalFramePtrReg(CPUType CPU) const {
@@ -781,7 +792,7 @@
         EncodedFramePtrReg((uint32_t(Flags) >> 16U) & 0x3U), CPU);
   }
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 
 private:
 };
@@ -799,11 +810,11 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t CodeOffset;
-  uint16_t Segment;
+  uint32_t CodeOffset = 0;
+  uint16_t Segment = 0;
   TypeIndex Type;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_HEAPALLOCSITE
@@ -820,12 +831,12 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t CodeOffset;
-  uint16_t Segment;
-  uint16_t CallInstructionSize;
+  uint32_t CodeOffset = 0;
+  uint16_t Segment = 0;
+  uint16_t CallInstructionSize = 0;
   TypeIndex Type;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_FRAMECOOKIE
@@ -841,12 +852,12 @@
     return RecordOffset + RelocationOffset;
   }
 
-  uint32_t CodeOffset;
-  uint16_t Register;
+  uint32_t CodeOffset = 0;
+  uint16_t Register = 0;
   FrameCookieKind CookieKind;
-  uint8_t Flags;
+  uint8_t Flags = 0;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_UDT, S_COBOLUDT
@@ -859,20 +870,20 @@
   TypeIndex Type;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_BUILDINFO
 class BuildInfoSym : public SymbolRecord {
 public:
   explicit BuildInfoSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  BuildInfoSym(uint32_t RecordOffset)
+  explicit BuildInfoSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::BuildInfoSym),
         RecordOffset(RecordOffset) {}
 
   TypeIndex BuildId;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_BPREL32
@@ -883,11 +894,11 @@
       : SymbolRecord(SymbolRecordKind::BPRelativeSym),
         RecordOffset(RecordOffset) {}
 
-  int32_t Offset;
+  int32_t Offset = 0;
   TypeIndex Type;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_REGREL32
@@ -898,19 +909,19 @@
       : SymbolRecord(SymbolRecordKind::RegRelativeSym),
         RecordOffset(RecordOffset) {}
 
-  uint32_t Offset;
+  uint32_t Offset = 0;
   TypeIndex Type;
   RegisterId Register;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_CONSTANT, S_MANCONSTANT
 class ConstantSym : public SymbolRecord {
 public:
   explicit ConstantSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  ConstantSym(uint32_t RecordOffset)
+  explicit ConstantSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::ConstantSym),
         RecordOffset(RecordOffset) {}
 
@@ -918,7 +929,7 @@
   APSInt Value;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_LDATA32, S_GDATA32, S_LMANDATA, S_GMANDATA
@@ -927,7 +938,7 @@
 
 public:
   explicit DataSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
-  DataSym(uint32_t RecordOffset)
+  explicit DataSym(uint32_t RecordOffset)
       : SymbolRecord(SymbolRecordKind::DataSym), RecordOffset(RecordOffset) {}
 
   uint32_t getRelocationOffset() const {
@@ -935,11 +946,11 @@
   }
 
   TypeIndex Type;
-  uint32_t DataOffset;
-  uint16_t Segment;
+  uint32_t DataOffset = 0;
+  uint16_t Segment = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_LTHREAD32, S_GTHREAD32
@@ -957,11 +968,11 @@
   }
 
   TypeIndex Type;
-  uint32_t DataOffset;
-  uint16_t Segment;
+  uint32_t DataOffset = 0;
+  uint16_t Segment = 0;
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_UNAMESPACE
@@ -974,7 +985,7 @@
 
   StringRef Name;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
 // S_ANNOTATION
@@ -989,12 +1000,9 @@
   uint16_t Segment = 0;
   std::vector<StringRef> Strings;
 
-  uint32_t RecordOffset;
+  uint32_t RecordOffset = 0;
 };
 
-using CVSymbol = CVRecord<SymbolKind>;
-using CVSymbolArray = VarStreamArray<CVSymbol>;
-
 Expected<CVSymbol> readSymbolFromStream(BinaryStreamRef Stream,
                                         uint32_t Offset);
 
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
index 57dbc56..71bc70d 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
@@ -9,7 +9,8 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORDHELPERS_H
 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORDHELPERS_H
 
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
 
 namespace llvm {
 namespace codeview {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeCollection.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeCollection.h
index 58b1dd0..bde5a8b 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeCollection.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeCollection.h
@@ -10,9 +10,8 @@
 #define LLVM_DEBUGINFO_CODEVIEW_TYPECOLLECTION_H
 
 #include "llvm/ADT/StringRef.h"
-
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
 
 namespace llvm {
 namespace codeview {
@@ -30,6 +29,7 @@
   virtual bool contains(TypeIndex Index) = 0;
   virtual uint32_t size() = 0;
   virtual uint32_t capacity() = 0;
+  virtual bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) = 0;
 
   template <typename TFunc> void ForEachRecord(TFunc Func) {
     Optional<TypeIndex> Next = getFirst();
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeDeserializer.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
index 081de32..2b17f5c 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
@@ -66,7 +66,7 @@
 
   Error visitTypeBegin(CVType &Record) override {
     assert(!Mapping && "Already in a type mapping!");
-    Mapping = llvm::make_unique<MappingInfo>(Record.content());
+    Mapping = std::make_unique<MappingInfo>(Record.content());
     return Mapping->Mapping.visitTypeBegin(Record);
   }
 
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeHashing.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeHashing.h
index b0a16cc..9f34d02 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeHashing.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeHashing.h
@@ -86,6 +86,16 @@
 
   bool empty() const { return *(const uint64_t*)Hash.data() == 0; }
 
+  friend inline bool operator==(const GloballyHashedType &L,
+                                const GloballyHashedType &R) {
+    return L.Hash == R.Hash;
+  }
+
+  friend inline bool operator!=(const GloballyHashedType &L,
+                                const GloballyHashedType &R) {
+    return !(L.Hash == R.Hash);
+  }
+
   /// Given a sequence of bytes representing a record, compute a global hash for
   /// this record.  Due to the nature of global hashes incorporating the hashes
   /// of referenced records, this function requires a list of types and ids
@@ -161,15 +171,10 @@
     return Hashes;
   }
 };
-#if defined(_MSC_VER)
-// is_trivially_copyable is not available in older versions of libc++, but it is
-// available in all supported versions of MSVC, so at least this gives us some
-// coverage.
 static_assert(std::is_trivially_copyable<GloballyHashedType>::value,
               "GloballyHashedType must be trivially copyable so that we can "
               "reinterpret_cast arrays of hash data to arrays of "
               "GloballyHashedType");
-#endif
 } // namespace codeview
 
 template <> struct DenseMapInfo<codeview::LocallyHashedType> {
@@ -206,7 +211,7 @@
 
   static bool isEqual(codeview::GloballyHashedType LHS,
                       codeview::GloballyHashedType RHS) {
-    return LHS.Hash == RHS.Hash;
+    return LHS == RHS;
   }
 };
 
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndex.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndex.h
index b9e2562..bdc6cf4 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndex.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndex.h
@@ -116,13 +116,22 @@
 
   uint32_t toArrayIndex() const {
     assert(!isSimple());
-    return getIndex() - FirstNonSimpleIndex;
+    return (getIndex() & ~DecoratedItemIdMask) - FirstNonSimpleIndex;
   }
 
   static TypeIndex fromArrayIndex(uint32_t Index) {
     return TypeIndex(Index + FirstNonSimpleIndex);
   }
 
+  static TypeIndex fromDecoratedArrayIndex(bool IsItem, uint32_t Index) {
+    return TypeIndex((Index + FirstNonSimpleIndex) |
+                     (IsItem ? DecoratedItemIdMask : 0));
+  }
+
+  TypeIndex removeDecoration() {
+    return TypeIndex(Index & ~DecoratedItemIdMask);
+  }
+
   SimpleTypeKind getSimpleKind() const {
     assert(isSimple());
     return static_cast<SimpleTypeKind>(Index & SimpleKindMask);
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
index 4697687..f4f5835 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
@@ -10,8 +10,8 @@
 #define LLVM_DEBUGINFO_CODEVIEW_TYPEINDEXDISCOVERY_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecord.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecord.h
index b147dd6..3b6d1b0 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -14,7 +14,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/iterator_range.h"
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/CodeView/GUID.h"
@@ -32,15 +31,10 @@
 using support::ulittle16_t;
 using support::ulittle32_t;
 
-using CVType = CVRecord<TypeLeafKind>;
-using RemappedType = RemappedRecord<TypeLeafKind>;
-
 struct CVMemberRecord {
   TypeLeafKind Kind;
   ArrayRef<uint8_t> Data;
 };
-using CVTypeArray = VarStreamArray<CVType>;
-using CVTypeRange = iterator_range<CVTypeArray::Iterator>;
 
 /// Equvalent to CV_fldattr_t in cvinfo.h.
 struct MemberAttributes {
@@ -144,7 +138,7 @@
   ModifierOptions getModifiers() const { return Modifiers; }
 
   TypeIndex ModifiedType;
-  ModifierOptions Modifiers;
+  ModifierOptions Modifiers = ModifierOptions::None;
 };
 
 // LF_PROCEDURE
@@ -168,7 +162,7 @@
   TypeIndex ReturnType;
   CallingConvention CallConv;
   FunctionOptions Options;
-  uint16_t ParameterCount;
+  uint16_t ParameterCount = 0;
   TypeIndex ArgumentList;
 };
 
@@ -202,9 +196,9 @@
   TypeIndex ThisType;
   CallingConvention CallConv;
   FunctionOptions Options;
-  uint16_t ParameterCount;
+  uint16_t ParameterCount = 0;
   TypeIndex ArgumentList;
-  int32_t ThisPointerAdjustment;
+  int32_t ThisPointerAdjustment = 0;
 };
 
 // LF_LABEL
@@ -351,7 +345,7 @@
   }
 
   TypeIndex ReferentType;
-  uint32_t Attrs;
+  uint32_t Attrs = 0;
   Optional<MemberPointerInfo> MemberInfo;
 
   void setAttrs(PointerKind PK, PointerMode PM, PointerOptions PO,
@@ -414,7 +408,7 @@
 
   TypeIndex ElementType;
   TypeIndex IndexType;
-  uint64_t Size;
+  uint64_t Size = 0;
   StringRef Name;
 };
 
@@ -459,7 +453,7 @@
   StringRef getName() const { return Name; }
   StringRef getUniqueName() const { return UniqueName; }
 
-  uint16_t MemberCount;
+  uint16_t MemberCount = 0;
   ClassOptions Options;
   TypeIndex FieldList;
   StringRef Name;
@@ -496,7 +490,7 @@
 
   TypeIndex DerivationList;
   TypeIndex VTableShape;
-  uint64_t Size;
+  uint64_t Size = 0;
 };
 
 // LF_UNION
@@ -517,7 +511,7 @@
 
   uint64_t getSize() const { return Size; }
 
-  uint64_t Size;
+  uint64_t Size = 0;
 };
 
 // LF_ENUM
@@ -550,8 +544,8 @@
   uint8_t getBitSize() const { return BitSize; }
 
   TypeIndex Type;
-  uint8_t BitSize;
-  uint8_t BitOffset;
+  uint8_t BitSize = 0;
+  uint8_t BitOffset = 0;
 };
 
 // LF_VTSHAPE
@@ -592,7 +586,7 @@
   StringRef getName() const { return Name; }
 
   GUID Guid;
-  uint32_t Age;
+  uint32_t Age = 0;
   StringRef Name;
 };
 
@@ -644,7 +638,7 @@
 
   TypeIndex UDT;
   TypeIndex SourceFile;
-  uint32_t LineNumber;
+  uint32_t LineNumber = 0;
 };
 
 // LF_UDT_MOD_SRC_LINE
@@ -664,8 +658,8 @@
 
   TypeIndex UDT;
   TypeIndex SourceFile;
-  uint32_t LineNumber;
-  uint16_t Module;
+  uint32_t LineNumber = 0;
+  uint16_t Module = 0;
 };
 
 // LF_BUILDINFO
@@ -703,7 +697,7 @@
       : TypeRecord(TypeRecordKind::VFTable), CompleteClass(CompleteClass),
         OverriddenVFTable(OverriddenVFTable), VFPtrOffset(VFPtrOffset) {
     MethodNames.push_back(Name);
-    MethodNames.insert(MethodNames.end(), Methods.begin(), Methods.end());
+    llvm::append_range(MethodNames, Methods);
   }
 
   TypeIndex getCompleteClass() const { return CompleteClass; }
@@ -717,7 +711,7 @@
 
   TypeIndex CompleteClass;
   TypeIndex OverriddenVFTable;
-  uint32_t VFPtrOffset;
+  uint32_t VFPtrOffset = 0;
   std::vector<StringRef> MethodNames;
 };
 
@@ -749,7 +743,7 @@
 
   TypeIndex Type;
   MemberAttributes Attrs;
-  int32_t VFTableOffset;
+  int32_t VFTableOffset = 0;
   StringRef Name;
 };
 
@@ -780,7 +774,7 @@
   TypeIndex getMethodList() const { return MethodList; }
   StringRef getName() const { return Name; }
 
-  uint16_t NumOverloads;
+  uint16_t NumOverloads = 0;
   TypeIndex MethodList;
   StringRef Name;
 };
@@ -806,7 +800,7 @@
 
   MemberAttributes Attrs;
   TypeIndex Type;
-  uint64_t FieldOffset;
+  uint64_t FieldOffset = 0;
   StringRef Name;
 };
 
@@ -883,7 +877,7 @@
 
   MemberAttributes Attrs;
   TypeIndex Type;
-  uint64_t Offset;
+  uint64_t Offset = 0;
 };
 
 // LF_VBCLASS, LF_IVBCLASS
@@ -911,8 +905,8 @@
   MemberAttributes Attrs;
   TypeIndex BaseType;
   TypeIndex VBPtrType;
-  uint64_t VBPtrOffset;
-  uint64_t VTableIndex;
+  uint64_t VBPtrOffset = 0;
+  uint64_t VTableIndex = 0;
 };
 
 /// LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records
@@ -941,9 +935,9 @@
   uint32_t getSignature() const { return Signature; }
   StringRef getPrecompFilePath() const { return PrecompFilePath; }
 
-  uint32_t StartTypeIndex;
-  uint32_t TypesCount;
-  uint32_t Signature;
+  uint32_t StartTypeIndex = 0;
+  uint32_t TypesCount = 0;
+  uint32_t Signature = 0;
   StringRef PrecompFilePath;
 };
 
@@ -955,7 +949,7 @@
 
   uint32_t getSignature() const { return Signature; }
 
-  uint32_t Signature;
+  uint32_t Signature = 0;
 };
 
 } // end namespace codeview
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordHelpers.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordHelpers.h
index e84704d..041f521 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordHelpers.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordHelpers.h
@@ -9,19 +9,39 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORDHELPERS_H
 #define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDHELPERS_H
 
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
 
 namespace llvm {
-  namespace codeview {
-    /// Given an arbitrary codeview type, determine if it is an LF_STRUCTURE,
-    /// LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class
-    /// option.
-    bool isUdtForwardRef(CVType CVT);
+namespace codeview {
 
-    /// Given a CVType which is assumed to be an LF_MODIFIER, return the
-    /// TypeIndex of the type that the LF_MODIFIER modifies.
-    TypeIndex getModifiedType(const CVType &CVT);
+/// Given an arbitrary codeview type, determine if it is an LF_STRUCTURE,
+/// LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class
+/// option.
+bool isUdtForwardRef(CVType CVT);
+
+/// Given a CVType which is assumed to be an LF_MODIFIER, return the
+/// TypeIndex of the type that the LF_MODIFIER modifies.
+TypeIndex getModifiedType(const CVType &CVT);
+
+/// Return true if this record should be in the IPI stream of a PDB. In an
+/// object file, these record kinds will appear mixed into the .debug$T section.
+inline bool isIdRecord(TypeLeafKind K) {
+  switch (K) {
+  case TypeLeafKind::LF_FUNC_ID:
+  case TypeLeafKind::LF_MFUNC_ID:
+  case TypeLeafKind::LF_STRING_ID:
+  case TypeLeafKind::LF_SUBSTR_LIST:
+  case TypeLeafKind::LF_BUILDINFO:
+  case TypeLeafKind::LF_UDT_SRC_LINE:
+  case TypeLeafKind::LF_UDT_MOD_SRC_LINE:
+    return true;
+  default:
+    return false;
   }
 }
 
+} // namespace codeview
+} // namespace llvm
+
 #endif
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
index 4c309c1..c6044d5 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H
 
 #include "llvm/ADT/Optional.h"
+#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
 #include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h"
 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
 #include "llvm/Support/Error.h"
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
index d0506cc..04d7c7b 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
@@ -11,7 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
index 4f2e5de..01525d0 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h
@@ -9,13 +9,11 @@
 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H
 #define LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H
 
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-
 namespace llvm {
 class StringRef;
 
 namespace codeview {
+class TypeIndex;
 
 class TypeSymbolEmitter {
 private:
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeTableCollection.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
index 5cbe340..c300874 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeTableCollection.h
@@ -29,6 +29,7 @@
   bool contains(TypeIndex Index) override;
   uint32_t size() override;
   uint32_t capacity() override;
+  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
 
 private:
   BumpPtrAllocator Allocator;
diff --git a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h
index 169715b..fb0b579 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h
@@ -82,11 +82,6 @@
     Pipeline.push_back(&Callbacks);
   }
 
-  void addCallbackToPipelineFront(TypeVisitorCallbacks &Callbacks) {
-    auto CallBackItr = Pipeline.begin();
-    Pipeline.insert(CallBackItr, &Callbacks);
-  }
-
 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
   Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
     return visitKnownRecordImpl(CVR, Record);                                  \