summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit0a2c458ae0872f3a8f1cd93f4abc390beef655d9 (patch)
tree62011603239abb2d23c0f55173a3627afa5d43b4 /llvm/lib/VMCore/Function.cpp
parent6c41ac5b381961e078f610f3feb2ee70f0096d67 (diff)
downloadbcm5719-llvm-0a2c458ae0872f3a8f1cd93f4abc390beef655d9.tar.gz
bcm5719-llvm-0a2c458ae0872f3a8f1cd93f4abc390beef655d9.zip
Add an accessor to Function so that Passes can easily get access to the context.
llvm-svn: 74714
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r--llvm/lib/VMCore/Function.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 045056643b5..eeade051ac5 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/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());
}
OpenPOWER on IntegriCloud