Add two new accessors to the C bindings, patch by Wladimir van der Laan!
authorChris Lattner <sabre@nondot.org>
Mon, 6 Jul 2009 17:29:59 +0000 (17:29 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 6 Jul 2009 17:29:59 +0000 (17:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74836 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/Core.h
lib/VMCore/Core.cpp

index 3538c0837187b0956877b83a1d5a26a27eef7d8d..e0eaf9b5cbae574d83b2490baeb75a0f718b84f7 100644 (file)
@@ -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,
index 6eb188907f560adf38fd98a85a312f8b312a2704..ac2dfcc647b602e6f01f1061cdd577a44c88730e 100644 (file)
@@ -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,