diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-13 20:57:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-13 20:57:00 +0000 |
commit | 69da5cf26143e4542d4bf8c78ffac6d079efe5c9 (patch) | |
tree | 22a05be14b5a74d3bbd2f1dcb8a07d91f4238177 /lib/VMCore/Function.cpp | |
parent | 0b16ae209a1d0876a7ea6800bb567d925443cba3 (diff) |
- Change Function's so that their argument list is populated when they are
constructed. Before, external functions would have an empty argument list,
now a Function ALWAYS has a populated argument list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index d7e8bea9dd..d03a72a81a 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -61,7 +61,7 @@ void Argument::setName(const std::string &name, SymbolTable *ST) { "Invalid symtab argument!"); if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this); Value::setName(name); - if (P && hasName()) P->getSymbolTable()->insert(this); + if (P && hasName()) P->getSymbolTableSure()->insert(this); } void Argument::setParent(Function *parent) { @@ -86,6 +86,13 @@ Function::Function(const FunctionType *Ty, bool isInternal, ArgumentList.setParent(this); ParentSymTab = SymTab = 0; + // Create the arguments vector, all arguments start out unnamed. + for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) { + assert(Ty->getParamType(i) != Type::VoidTy && + "Cannot have void typed arguments!"); + ArgumentList.push_back(new Argument(Ty->getParamType(i))); + } + // Make sure that we get added to a function LeakDetector::addGarbageObject(this); |