diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index f2e6bd5c64e..598f9fd0c24 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -12,8 +12,25 @@ #include "llvm/GlobalVariable.h" #include "llvm/BasicBlock.h" #include "llvm/iOther.h" +#include "llvm/Argument.h" #include "ValueHolderImpl.h" +//===----------------------------------------------------------------------===// +// Argument Implementation +//===----------------------------------------------------------------------===// + +// Specialize setName to take care of symbol table majik +void Argument::setName(const std::string &name, SymbolTable *ST) { + Function *P; + assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && + "Invalid symtab argument!"); + if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this); + Value::setName(name); + if (P && hasName()) P->getSymbolTable()->insert(this); +} + + + //===----------------------------------------------------------------------===// // Function Implementation //===----------------------------------------------------------------------===// @@ -22,8 +39,8 @@ // Instantiate Templates - This ugliness is the price we have to pay // for having a ValueHolderImpl.h file seperate from ValueHolder.h! :( // -template class ValueHolder; -template class ValueHolder; +template class ValueHolder; +template class ValueHolder; Function::Function(const FunctionType *Ty, bool isInternal, const std::string &name)