// Argument Implementation
//===----------------------------------------------------------------------===//
-Argument::Argument(const Type *Ty, const std::string &Name, Function *Par)
+Argument::Argument(const Type *Ty, const Twine &Name, Function *Par)
: Value(Ty, Value::ArgumentVal) {
Parent = 0;
// Helper Methods in Function
//===----------------------------------------------------------------------===//
-LLVMContext *Function::getContext() const {
- const Module* M = getParent();
- if (M) return &M->getContext();
- return 0;
+LLVMContext &Function::getContext() const {
+ return getType()->getContext();
}
const FunctionType *Function::getFunctionType() const {
//===----------------------------------------------------------------------===//
Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
- const std::string &name, Module *ParentModule)
+ const Twine &name, Module *ParentModule)
: GlobalValue(PointerType::getUnqual(Ty),
Value::FunctionVal, 0, 0, Linkage, name) {
assert(FunctionType::isValidReturnType(getReturnType()) &&