From 0a205a459884ec745df1c529396dd921f029dafd Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sun, 5 Jul 2009 22:41:43 +0000 Subject: More LLVMContext-ification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/BasicBlock.cpp | 4 ++++ lib/VMCore/Function.cpp | 4 ++-- lib/VMCore/LLVMContext.cpp | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/VMCore') 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; 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& Params, bool isVarArg) { -- cgit v1.1