summaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-05 22:41:43 +0000
committerOwen Anderson <resistor@mac.com>2009-07-05 22:41:43 +0000
commit0a205a459884ec745df1c529396dd921f029dafd (patch)
tree905109491ef6c2ea3d99d01fc48af9c2c633e645 /lib/VMCore
parentdb882950f3bcf7f710843610e917988daeafffc2 (diff)
downloadexternal_llvm-0a205a459884ec745df1c529396dd921f029dafd.zip
external_llvm-0a205a459884ec745df1c529396dd921f029dafd.tar.gz
external_llvm-0a205a459884ec745df1c529396dd921f029dafd.tar.bz2
More LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/BasicBlock.cpp4
-rw-r--r--lib/VMCore/Function.cpp4
-rw-r--r--lib/VMCore/LLVMContext.cpp8
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 3065766..f39e1ca 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -29,6 +29,10 @@ ValueSymbolTable *BasicBlock::getValueSymbolTable() {
return 0;
}
+LLVMContext* BasicBlock::getContext() const {
+ return Parent ? Parent->getContext() : 0;
+}
+
// Explicit instantiation of SymbolTableListTraits since some of the methods
// are not in the public header file...
template class SymbolTableListTraits<Instruction, BasicBlock>;
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index eeade05..1fa0378 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -114,8 +114,8 @@ void Argument::removeAttr(Attributes attr) {
// Helper Methods in Function
//===----------------------------------------------------------------------===//
-LLVMContext* Function::getContext() {
- Module* M = getParent();
+LLVMContext* Function::getContext() const {
+ const Module* M = getParent();
if (M) return &M->getContext();
return 0;
}
diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp
index fe2cb7b..a96d2d9 100644
--- a/lib/VMCore/LLVMContext.cpp
+++ b/lib/VMCore/LLVMContext.cpp
@@ -374,6 +374,10 @@ Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val,
return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx);
}
+Constant* LLVMContext::getConstantExprSizeOf(const Type* Ty) {
+ return ConstantExpr::getSizeOf(Ty);
+}
+
Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) {
return ConstantExpr::getZeroValueForNegationExpr(Ty);
}
@@ -428,6 +432,10 @@ MDString* LLVMContext::getMDString(const std::string &Str) {
}
// FunctionType accessors
+FunctionType* LLVMContext::getFunctionType(const Type* Result, bool isVarArg) {
+ return FunctionType::get(Result, isVarArg);
+}
+
FunctionType* LLVMContext::getFunctionType(const Type* Result,
const std::vector<const Type*>& Params,
bool isVarArg) {