From 416457098286b389d134937f93917cd9ae394816 Mon Sep 17 00:00:00 2001 From: Andrea Shepard <andrea@special-circumstanc.es> Date: Sat, 16 Nov 2019 01:25:57 +0000 Subject: [PATCH] Use LLVM name/label macros in nothing.c --- src/parsers/nothing.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/parsers/nothing.c b/src/parsers/nothing.c index 3ec425df..ed0a4060 100644 --- a/src/parsers/nothing.c +++ b/src/parsers/nothing.c @@ -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; } -- GitLab