diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-06 17:29:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-06 17:29:59 +0000 |
commit | 7f31824a44a2698367882d1ac76f887b09cd01cf (patch) | |
tree | b30c0b332f10dc290f58f5ce6910f9b811c8e328 | |
parent | 738cc28f4d8c98c71569d3f4641611524433aeea (diff) | |
download | bcm5719-llvm-7f31824a44a2698367882d1ac76f887b09cd01cf.tar.gz bcm5719-llvm-7f31824a44a2698367882d1ac76f887b09cd01cf.zip |
Add two new accessors to the C bindings, patch by Wladimir van der Laan!
llvm-svn: 74836
-rw-r--r-- | llvm/include/llvm-c/Core.h | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index 3538c083718..e0eaf9b5cba 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/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/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 6eb188907f5..ac2dfcc647b 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/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<UndefValue>(unwrap(Val)); } +LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty) { + return wrap(ConstantPointerNull::get(unwrap<PointerType>(Ty))); +} + /*--.. Operations on scalar constants ......................................--*/ LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, |