Add an accessor to Function so that Passes can easily get access to the context.
llvm-svn: 74714
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 0450566..eeade05 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -114,6 +114,12 @@
// 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());
}