aboutsummaryrefslogtreecommitdiff
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-20 18:36:02 +0000
committerChris Lattner <sabre@nondot.org>2002-11-20 18:36:02 +0000
commit6e6026b46569b01f8f6d4dcdb6c899c3a9c76b3e (patch)
tree57322a305c9e9d3273ae9d3d09728ec2662e97d8 /lib/AsmParser
parentc09aab0a4de7e3f65dd830803faadb7abae28872 (diff)
- Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/llvmAsmParser.y26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index f71fa585da..1c990e72aa 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -211,16 +211,18 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
case ValID::NameVal: { // Is it a named definition?
string Name(D.Name);
SymbolTable *SymTab = 0;
- if (inFunctionScope()) SymTab = CurMeth.CurrentFunction->getSymbolTable();
- Value *N = SymTab ? SymTab->lookup(Type::TypeTy, Name) : 0;
+ Value *N = 0;
+ if (inFunctionScope()) {
+ SymTab = &CurMeth.CurrentFunction->getSymbolTable();
+ N = SymTab->lookup(Type::TypeTy, Name);
+ }
if (N == 0) {
// Symbol table doesn't automatically chain yet... because the function
// hasn't been added to the module...
//
- SymTab = CurModule.CurrentModule->getSymbolTable();
- if (SymTab)
- N = SymTab->lookup(Type::TypeTy, Name);
+ SymTab = &CurModule.CurrentModule->getSymbolTable();
+ N = SymTab->lookup(Type::TypeTy, Name);
if (N == 0) break;
}
@@ -251,10 +253,10 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
}
static Value *lookupInSymbolTable(const Type *Ty, const string &Name) {
- SymbolTable *SymTab =
+ SymbolTable &SymTab =
inFunctionScope() ? CurMeth.CurrentFunction->getSymbolTable() :
CurModule.CurrentModule->getSymbolTable();
- return SymTab ? SymTab->lookup(Ty, Name) : 0;
+ return SymTab.lookup(Ty, Name);
}
// getValNonImprovising - Look up the value specified by the provided type and
@@ -481,11 +483,11 @@ static bool setValueName(Value *V, char *NameStr) {
ThrowException("Can't assign name '" + Name +
"' to a null valued instruction!");
- SymbolTable *ST = inFunctionScope() ?
- CurMeth.CurrentFunction->getSymbolTableSure() :
- CurModule.CurrentModule->getSymbolTableSure();
+ SymbolTable &ST = inFunctionScope() ?
+ CurMeth.CurrentFunction->getSymbolTable() :
+ CurModule.CurrentModule->getSymbolTable();
- Value *Existing = ST->lookup(V->getType(), Name);
+ Value *Existing = ST.lookup(V->getType(), Name);
if (Existing) { // Inserting a name that is already defined???
// There is only one case where this is allowed: when we are refining an
// opaque type. In this case, Existing will be an opaque type.
@@ -528,7 +530,7 @@ static bool setValueName(Value *V, char *NameStr) {
V->getType()->getDescription() + "' type plane!");
}
- V->setName(Name, ST);
+ V->setName(Name, &ST);
return false;
}