From 6326a4238df05dafd7547cfa2cd71111cd6702a6 Mon Sep 17 00:00:00 2001
From: Devang Patel
Date: Mon, 15 Aug 2011 23:00:00 +0000
Subject: [PATCH] Add a finalize() hook, that'll let DIBuilder construct
compile unit lazily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137673 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/ReleaseNotes.html | 4 ++++
include/llvm/Analysis/DIBuilder.h | 3 +++
lib/Analysis/DIBuilder.cpp | 4 ++++
3 files changed, 11 insertions(+)
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html
index 258555496c1..ebcbf15dadf 100644
--- a/docs/ReleaseNotes.html
+++ b/docs/ReleaseNotes.html
@@ -673,6 +673,10 @@ it run faster:
The LLVMAddLowerSetJmpPass
function from the C API was removed
because the LowerSetJmp
pass was removed.
+The DIBuilder
interface used by front ends to encode debugging
+ information in the LLVM IR now expects clients to use DIBuilder::finalize()
+ at the end of translation unit to complete debugging information encoding.
+
diff --git a/include/llvm/Analysis/DIBuilder.h b/include/llvm/Analysis/DIBuilder.h
index a706cc8f35d..0f6fd503384 100644
--- a/include/llvm/Analysis/DIBuilder.h
+++ b/include/llvm/Analysis/DIBuilder.h
@@ -59,6 +59,9 @@ namespace llvm {
const MDNode *getCU() { return TheCU; }
enum ComplexAddrKind { OpPlus=1, OpDeref };
+ /// finalize - Construct any deferred debug info descriptors.
+ void finalize();
+
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
/// @param Lang Source programming language, eg. dwarf::DW_LANG_C99
diff --git a/lib/Analysis/DIBuilder.cpp b/lib/Analysis/DIBuilder.cpp
index da5780827ab..98a0ba085e1 100644
--- a/lib/Analysis/DIBuilder.cpp
+++ b/lib/Analysis/DIBuilder.cpp
@@ -31,6 +31,10 @@ static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
DIBuilder::DIBuilder(Module &m)
: M(m), VMContext(M.getContext()), TheCU(0), DeclareFn(0), ValueFn(0) {}
+/// finalize - Construct any deferred debug info descriptors.
+void DIBuilder::finalize() {
+}
+
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,