This commit adds the C API for removing global (removeFromParent).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi, I am new to LLVM phabricator.
I don't clrearly understand why this build fail happens. Any suggestion?
You can ignore the build failure; the infrastructure for pre-commit testing is new, and it looks like it failed spuriously.
If you're not using arcanist, please upload patches with full context (-U10000).
C APIs should have appropriate documentation. Some of the existing APIs are missing documentation, but please ensure new ones are properly documented.
How are you actually planning to use this API? As far as I can tell, given the other existing APIs, the GlobalVariable is guaranteed to leak.
@efriedma Thanks for your suggestion. I updated the diff via arc.
I wanted to make the C-library expose APIs consistently. LLVMRemoveBasicBlockFromParent and LLVMInstructionRemoveFromParent are already there but not for global variable.
What do you mean by leak?
What do you mean by leak?
Leak, as in a memory leak. After you've removed the global variable, there is no API to free the memory, or do anything useful with it.
I see. My bad. It seems there is no way to delete it after then.
Let me find another way.
Thanks.