From e4840bc611f8260065d3879a412ea3b501550995 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 6 Jul 2009 17:29:59 +0000 Subject: [PATCH] Add two new accessors to the C bindings, patch by Wladimir van der Laan! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74836 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm-c/Core.h | 2 ++ lib/VMCore/Core.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 3538c083718..e0eaf9b5cba 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -218,6 +218,7 @@ void LLVMSetTarget(LLVMModuleRef M, const char *Triple); /** See Module::addTypeName. */ int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty); void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name); +LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name); /** See Module::dump. */ void LLVMDumpModule(LLVMModuleRef M); @@ -398,6 +399,7 @@ LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty); int LLVMIsConstant(LLVMValueRef Val); int LLVMIsNull(LLVMValueRef Val); int LLVMIsUndef(LLVMValueRef Val); +LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty); /* Operations on scalar constants */ LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 6eb188907f5..ac2dfcc647b 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -101,6 +101,11 @@ void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name) { TST.remove(I); } +LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name) { + std::string N(Name); + return wrap(unwrap(M)->getTypeByName(N)); +} + void LLVMDumpModule(LLVMModuleRef M) { unwrap(M)->dump(); } @@ -313,6 +318,10 @@ int LLVMIsUndef(LLVMValueRef Val) { return isa(unwrap(Val)); } +LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty) { + return wrap(ConstantPointerNull::get(unwrap(Ty))); +} + /*--.. Operations on scalar constants ......................................--*/ LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, -- 2.34.1