[PATCH] D81341: [LLVM-C] Add C API for removing global
Kihong Heo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 7 06:52:54 PDT 2020
KihongHeo created this revision.
KihongHeo added reviewers: efriedma, kmclaughlin, sdesmalen, dexonsmith, dblaikie.
Herald added a reviewer: deadalnix.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This commit adds the C API for removing global (removeFromParent).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81341
Files:
llvm/include/llvm-c/Core.h
llvm/lib/IR/Core.cpp
Index: llvm/lib/IR/Core.cpp
===================================================================
--- llvm/lib/IR/Core.cpp
+++ llvm/lib/IR/Core.cpp
@@ -2130,6 +2130,10 @@
unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
}
+void LLVMRemoveGlobal(LLVMValueRef GlobalVar) {
+ unwrap<GlobalVariable>(GlobalVar)->removeFromParent();
+}
+
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar) {
GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
if ( !GV->hasInitializer() )
Index: llvm/include/llvm-c/Core.h
===================================================================
--- llvm/include/llvm-c/Core.h
+++ llvm/include/llvm-c/Core.h
@@ -2301,6 +2301,7 @@
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
+void LLVMRemoveGlobal(LLVMValueRef GlobalVar);
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81341.269051.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200607/bea0b28e/attachment.bin>
More information about the llvm-commits
mailing list