Use new DIBuilder::finalize() at the end to wrap up debug info encoding for a translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137674 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h
index 09e4628..fdc3baf 100644
--- a/lib/CodeGen/CGDebugInfo.h
+++ b/lib/CodeGen/CGDebugInfo.h
@@ -152,6 +152,7 @@
 public:
   CGDebugInfo(CodeGenModule &CGM);
   ~CGDebugInfo();
+  void finalize() { DBuilder.finalize(); }
 
   /// setLocation - Update the current source location. If \arg loc is
   /// invalid it is ignored.
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index d5d3463..d442b09 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -125,6 +125,8 @@
 }
 
 void CodeGenModule::Release() {
+  if (DebugInfo)
+    DebugInfo->finalize();
   EmitDeferred();
   EmitCXXGlobalInitFunc();
   EmitCXXGlobalDtorFunc();