From: Chris Lattner Date: Sun, 28 Nov 2010 20:03:44 +0000 (+0000) Subject: add a function to the C api to get the context out of a module, patch X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a1ac3bbec703f7faf20cbc06fa0eb9d34bb4f5f6;p=oota-llvm.git add a function to the C api to get the context out of a module, patch by Eric Dobson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120259 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 433958323f3..b9a8e4af568 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -329,6 +329,9 @@ void LLVMDumpModule(LLVMModuleRef M); /** See Module::setModuleInlineAsm. */ void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm); +/** See Module::getContext. */ +LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M); + /*===-- Types -------------------------------------------------------------===*/ /* LLVM types conform to the following hierarchy: diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index eb0af30a2fc..858f49cdf51 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -138,6 +138,12 @@ void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) { } +/*--.. Operations on module contexts ......................................--*/ +LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M) { + return wrap(&unwrap(M)->getContext()); +} + + /*===-- Operations on types -----------------------------------------------===*/ /*--.. Operations on all types (mostly) ....................................--*/