Skip to content
Snippets Groups Projects
Commit 41645709 authored by Andrea Shepard's avatar Andrea Shepard
Browse files

Use LLVM name/label macros in nothing.c

parent d6e07456
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,7 @@ static bool nothing_llvm(HLLVMParserCompileContext *ctxt,
/* Allocator */
HAllocator *mm__;
/* Names */
char *nothing_entry_bb_name = NULL;
int nothing_entry_bb_name_len = 0;
H_LLVM_DECLARE_NAME(nothing);
/* Nothing entry bb */
LLVMBasicBlockRef entry;
/* Nothing result */
......@@ -48,11 +47,8 @@ static bool nothing_llvm(HLLVMParserCompileContext *ctxt,
mm__ = ctxt->mm__;
/* This one just always returns NULL */
nothing_entry_bb_name_len = snprintf(NULL, 0, "nothing_entry_%p", p);
nothing_entry_bb_name = h_new(char, nothing_entry_bb_name_len + 1);
snprintf(nothing_entry_bb_name, nothing_entry_bb_name_len + 1,
"nothing_entry_%p", p);
entry = LLVMAppendBasicBlock(ctxt->func, nothing_entry_bb_name);
H_LLVM_COMPUTE_NAME(nothing, p);
entry = LLVMAppendBasicBlock(ctxt->func, nothing_name);
LLVMBuildBr(ctxt->builder, entry);
LLVMPositionBuilderAtEnd(ctxt->builder, entry);
rv = LLVMConstNull(ctxt->llvm_parseresultptr);
......@@ -60,10 +56,8 @@ static bool nothing_llvm(HLLVMParserCompileContext *ctxt,
/* Pass it back out */
*res = rv;
if (nothing_entry_bb_name) {
h_free(nothing_entry_bb_name);
nothing_entry_bb_name = NULL;
}
/* Free names */
H_LLVM_FREE_NAME(nothing);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment