diff options
| author | Robert Widmann <devteam.codafi@gmail.com> | 2019-01-08 06:24:19 +0000 |
|---|---|---|
| committer | Robert Widmann <devteam.codafi@gmail.com> | 2019-01-08 06:24:19 +0000 |
| commit | 616ed1722111a3dcb5d339fe6ce8a5f6d69bdc80 (patch) | |
| tree | 114d5f467e6636cb8c69ea860dc5099b62d97907 /llvm/lib | |
| parent | 40dc48be0ead4682b96af15b487b981cbd48572e (diff) | |
| download | bcm5719-llvm-616ed1722111a3dcb5d339fe6ce8a5f6d69bdc80.tar.gz bcm5719-llvm-616ed1722111a3dcb5d339fe6ce8a5f6d69bdc80.zip | |
[LLVM-C] Allow For Creating a BasicBlock without a Parent Function
Summary: Add a utility function for creating a basic block without a parent function. A useful operation for compilers that need to synthesize and conditionally insert code without having to bother with appending and immediately unlinking a block.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D56279
llvm-svn: 350608
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Core.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 921c830cbf7..6f7c7afc59d 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2532,6 +2532,12 @@ LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB) { 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) { |

