From 0cb64ee34041db63e4df1e5c03fb059c866725e8 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 2 Jul 2009 18:03:58 +0000 Subject: Add an accessor to Function so that Passes can easily get access to the context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74714 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Function.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/VMCore') diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 0450566..eeade05 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -114,6 +114,12 @@ void Argument::removeAttr(Attributes attr) { // Helper Methods in Function //===----------------------------------------------------------------------===// +LLVMContext* Function::getContext() { + Module* M = getParent(); + if (M) return &M->getContext(); + return 0; +} + const FunctionType *Function::getFunctionType() const { return cast(getType()->getElementType()); } -- cgit v1.1