[LLVM-C] Move DIBuilder Bindings For Temporary MDNodes

Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D46632

llvm-svn: 332010
diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c
index 8bbe2b6..6cc3516 100644
--- a/llvm/tools/llvm-c-test/debuginfo.c
+++ b/llvm/tools/llvm-c-test/debuginfo.c
@@ -93,14 +93,23 @@
   LLVMMetadataRef ParamTypes[] = {Int64Ty, Int64Ty, VectorTy};
   LLVMMetadataRef FunctionTy =
     LLVMDIBuilderCreateSubroutineType(DIB, File, ParamTypes, 3, 0);
+
+  LLVMMetadataRef ReplaceableFunctionMetadata =
+    LLVMDIBuilderCreateReplaceableCompositeType(DIB, 0x15, "foo", 3,
+                                                File, File, 42,
+                                                0, 0, 0,
+                                                LLVMDIFlagFwdDecl,
+                                                "", 0);
+
+  LLVMMetadataRef FooParamLocation =
+    LLVMDIBuilderCreateDebugLocation(LLVMGetGlobalContext(), 42, 0,
+                                     ReplaceableFunctionMetadata, NULL);
   LLVMMetadataRef FunctionMetadata =
     LLVMDIBuilderCreateFunction(DIB, File, "foo", 3, "foo", 3,
                                 File, 42, FunctionTy, true, true,
                                 42, 0, false);
+  LLVMMetadataReplaceAllUsesWith(ReplaceableFunctionMetadata, FunctionMetadata);
 
-  LLVMMetadataRef FooParamLocation =
-    LLVMDIBuilderCreateDebugLocation(LLVMGetGlobalContext(), 42, 0,
-                                     FunctionMetadata, NULL);
   LLVMMetadataRef FooParamExpression =
     LLVMDIBuilderCreateExpression(DIB, NULL, 0);
   LLVMMetadataRef FooParamVar1 =