[PATCH] D56279: [LLVM-C] Allow For Creating a BasicBlock without a Parent Function

Robert Widmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 22:30:59 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350608: [LLVM-C] Allow For Creating a BasicBlock without a Parent Function (authored by CodaFi, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56279?vs=180104&id=180613#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56279/new/

https://reviews.llvm.org/D56279

Files:
  llvm/trunk/include/llvm-c/Core.h
  llvm/trunk/lib/IR/Core.cpp


Index: llvm/trunk/lib/IR/Core.cpp
===================================================================
--- llvm/trunk/lib/IR/Core.cpp
+++ llvm/trunk/lib/IR/Core.cpp
@@ -2532,6 +2532,12 @@
   return wrap(&*--I);
 }
 
+LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C,
+                                                const char *Name,
+                                                size_t NameLen) {
+  return wrap(llvm::BasicBlock::Create(*unwrap(C), StringRef(Name, NameLen)));
+}
+
 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
                                                 LLVMValueRef FnRef,
                                                 const char *Name) {
Index: llvm/trunk/include/llvm-c/Core.h
===================================================================
--- llvm/trunk/include/llvm-c/Core.h
+++ llvm/trunk/include/llvm-c/Core.h
@@ -2807,6 +2807,15 @@
 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
 
 /**
+ * Create a new basic block without inserting it into a function.
+ *
+ * @see llvm::BasicBlock::Create()
+ */
+LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C,
+                                                const char *Name,
+                                                size_t NameLen);
+
+/**
  * Append a basic block to the end of a function.
  *
  * @see llvm::BasicBlock::Create()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56279.180613.patch
Type: text/x-patch
Size: 1388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190108/637d57e8/attachment.bin>


More information about the llvm-commits mailing list