[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Chris Lattner
lattner at cs.uiuc.edu
Tue Nov 11 22:41:03 PST 2003
Changes in directory llvm/lib/AsmParser:
llvmAsmParser.y updated: 1.138 -> 1.139
---
Log message:
Fix bug PR107, patch contributed by Reid Spencer!
---
Diffs of the changes: (+26 -1)
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.138 llvm/lib/AsmParser/llvmAsmParser.y:1.139
--- llvm/lib/AsmParser/llvmAsmParser.y:1.138 Tue Nov 11 16:41:32 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y Tue Nov 11 22:40:30 2003
@@ -147,6 +147,7 @@
std::vector<ValueList> LateResolveValues;
std::vector<PATypeHolder> Types;
std::map<ValID, PATypeHolder> LateResolveTypes;
+ SymbolTable LocalSymtab;
bool isDeclare; // Is this function a forward declararation?
inline PerFunctionInfo() {
@@ -183,7 +184,8 @@
CurModule.DeclareNewGlobalValue(CurrentFunction, FID);
Values.clear(); // Clear out function local definitions
- Types.clear();
+ Types.clear(); // Clear out function local types
+ LocalSymtab.clear(); // Clear out function local symbol table
CurrentFunction = 0;
isDeclare = false;
}
@@ -555,7 +557,30 @@
V->getType()->getDescription() + "' type plane!");
}
+ // Set the name
V->setName(Name, &ST);
+
+ // If we're in function scope
+ if (inFunctionScope()) {
+ // Look up the symbol in the function's local symboltable
+ Existing = CurFun.LocalSymtab.lookup(V->getType(),Name);
+
+ // If it already exists
+ if (Existing) {
+ // Clear the symbol table so it doesn't complain when it
+ // gets destructed
+ CurFun.LocalSymtab.clear();
+
+ // Bail
+ ThrowException("Redefinition of value named '" + Name + "' in the '" +
+ V->getType()->getDescription() + "' type plane!");
+
+ // otherwise, since it doesn't exist
+ } else {
+ // Insert it.
+ CurFun.LocalSymtab.insert(V);
+ }
+ }
return false;
}
More information about the llvm-commits
mailing list