aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r--lib/VMCore/Function.cpp9
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);