[PDB] Better support for enumerating pointer types.

There were several issues with the previous implementation.

1) There were no tests.
2) We didn't support creating PDBSymbolTypePointer records for
   builtin types since those aren't described by LF_POINTER
   records.
3) We didn't support a wide enough variety of builtin types even
   ignoring pointers.

This patch fixes all of these issues.  In order to add tests,
it's helpful to be able to ignore the symbol index id hierarchy
because it makes the golden output from the DIA version not match
our output, so I've extended the dumper to disable dumping of id
fields.

llvm-svn: 342493
diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
index a4b1ecf..a661227 100644
--- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
@@ -65,18 +65,20 @@
 
 SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
                                          ModifierOptions Mods) {
-  // FIXME:  We will eventually need to handle pointers to other simple types,
-  // which are still simple types in the world of CodeView TypeIndexes.
-  if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct)
-    return 0;
+  if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct) {
+    SymIndexId Id = Cache.size();
+    Cache.emplace_back(
+        llvm::make_unique<NativeTypePointer>(Session, Id, Index));
+    return Id;
+  }
 
+  SymIndexId Id = Cache.size();
   const auto Kind = Index.getSimpleKind();
   const auto It = std::find_if(
       std::begin(BuiltinTypes), std::end(BuiltinTypes),
       [Kind](const BuiltinTypeEntry &Builtin) { return Builtin.Kind == Kind; });
   if (It == std::end(BuiltinTypes))
     return 0;
-  SymIndexId Id = Cache.size();
   Cache.emplace_back(llvm::make_unique<NativeTypeBuiltin>(Session, Id, Mods,
                                                           It->Type, It->Size));
   TypeIndexToSymbolId[Index] = Id;
@@ -175,12 +177,16 @@
   assert(SymbolId < Cache.size());
 
   // Id 0 is reserved.
-  if (SymbolId == 0)
+  if (SymbolId == 0 || SymbolId >= Cache.size())
     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;
+  // Make sure to handle the case where we've inserted a placeholder symbol
+  // for types we don't yet suppport.
+  NativeRawSymbol *NRS = Cache[SymbolId].get();
+  if (!NRS)
+    return nullptr;
+
+  return PDBSymbol::create(Session, *NRS);
 }
 
 NativeRawSymbol &SymbolCache::getNativeSymbolById(SymIndexId SymbolId) const {