summaryrefslogtreecommitdiff
path: root/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-02 18:03:58 +0000
committerOwen Anderson <resistor@mac.com>2009-07-02 18:03:58 +0000
commit62fabf5faba70c507c8fbe298260e9b3749fdd79 (patch)
treea01aafdaf0aa1c54e48b4f3d0ef9f8469f60bdc5 /lib/VMCore/Function.cpp
parent7c07f3ae8dd3ac5d6a2ac52c96cf41178b6ab396 (diff)
downloadllvm-62fabf5faba70c507c8fbe298260e9b3749fdd79.tar.gz
llvm-62fabf5faba70c507c8fbe298260e9b3749fdd79.tar.bz2
llvm-62fabf5faba70c507c8fbe298260e9b3749fdd79.tar.xz
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
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r--lib/VMCore/Function.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 045056643b..eeade051ac 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<FunctionType>(getType()->getElementType());
}