[llvm] 16661b1 - Expose `DIBuilder::finalizeSubprogram()` through the LLVM C API

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 21:00:03 PDT 2021


Author: Koutheir Attouchi
Date: 2021-09-30T20:59:41-07:00
New Revision: 16661b1a3c4c93959d87079a659615b4635e17c2

URL: https://github.com/llvm/llvm-project/commit/16661b1a3c4c93959d87079a659615b4635e17c2
DIFF: https://github.com/llvm/llvm-project/commit/16661b1a3c4c93959d87079a659615b4635e17c2.diff

LOG: Expose `DIBuilder::finalizeSubprogram()` through the LLVM C API

The LLVM C API function is called `LLVMDIBuilderFinalizeSubprogram()`.

Reviewed By: CodaFi

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

Added: 
    

Modified: 
    llvm/include/llvm-c/DebugInfo.h
    llvm/lib/IR/DebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 8a23929e2566d..0c7b5db087e3d 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -226,6 +226,13 @@ void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);
  */
 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
 
+/**
+ * Finalize a specific subprogram.
+ * No new variables may be added to this subprogram afterwards.
+ */
+void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder,
+                                     LLVMMetadataRef Subprogram);
+
 /**
  * A CompileUnit provides an anchor for all debugging
  * information generated during this instance of compilation.

diff  --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 34f5ffcf0ab24..6e36400d8d672 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -909,6 +909,11 @@ void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder) {
   unwrap(Builder)->finalize();
 }
 
+void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder,
+                                     LLVMMetadataRef subprogram) {
+  unwrap(Builder)->finalizeSubprogram(unwrapDI<DISubprogram>(subprogram));
+}
+
 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
     LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
     LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,


        


More information about the llvm-commits mailing list