[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
Thu Jan 3 10:49:17 PST 2019


CodaFi updated this revision to Diff 180104.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56279

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


Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ lib/IR/Core.cpp
@@ -2533,6 +2533,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: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -2806,6 +2806,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.
  *


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56279.180104.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/c775b865/attachment.bin>


More information about the llvm-commits mailing list