[PDB] Support pointer types in the native reader.

In order to start testing this, I've added a new mode to
llvm-pdbutil which is only really useful for writing tests.
It just dumps the value of raw fields in record format.
This isn't really ideal and it won't allow us to test some
important cases, but it's better than nothing for now.

llvm-svn: 341729
diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
index abba065e..71f8fdd 100644
--- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
@@ -7,6 +7,7 @@
 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypePointer.h"
 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
@@ -60,7 +61,7 @@
   }
   auto &Types = Tpi->typeCollection();
   return std::unique_ptr<IPDBEnumSymbols>(
-      new NativeEnumTypes(Session, Types, codeview::LF_ENUM));
+      new NativeEnumTypes(Session, Types, Kind));
 }
 
 SymIndexId SymbolCache::findSymbolByTypeIndex(codeview::TypeIndex Index) {
@@ -104,9 +105,12 @@
   case codeview::LF_ENUM:
     Id = createSymbol<NativeTypeEnum>(CVT);
     break;
+  case codeview::LF_POINTER:
+    Id = createSymbol<NativeTypePointer>(CVT);
+    break;
   default:
-    assert(false && "Unsupported native symbol type!");
-    return 0;
+    Id = createSymbolPlaceholder();
+    break;
   }
   TypeIndexToSymbolId[Index] = Id;
   return Id;
@@ -114,6 +118,10 @@
 
 std::unique_ptr<PDBSymbol>
 SymbolCache::getSymbolById(SymIndexId SymbolId) const {
+  // Id 0 is reserved.
+  if (SymbolId == 0)
+    return nullptr;
+
   // If the caller has a SymbolId, it'd better be in our SymbolCache.
   return SymbolId < Cache.size() ? PDBSymbol::create(Session, *Cache[SymbolId])
                                  : nullptr;