DebugInfo: Use MDTypeRef throughout the hierarchy

Use `MDTypeRef` (etc.) in the new debug info hierarchy rather than raw
`Metadata *` pointers.

I rolled in a change to `DIBuilder` that looks unrelated: take `DIType`
instead of `DITypeRef` as type arguments when creating variables.
However, this was the simplest way to use `MDTypeRef` within the
functions, and didn't require any cleanups from callers in clang (since
they were all passing in `DIType`s anyway, relying on their implicit
conversions to `DITypeRef`).

llvm-svn: 234197
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 550418a..f92d0b6 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -257,7 +257,7 @@
 
 void DICompositeType::setContainingType(DICompositeType ContainingType) {
   TypedTrackingMDRef<MDCompositeTypeBase> N(get());
-  N->replaceVTableHolder(ContainingType.getRef());
+  N->replaceVTableHolder(MDTypeRef::get(ContainingType));
   DbgNode = N;
 }