[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 26 01:26:01 PST 2003


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.142 -> 1.143

---
Log message:

To not barf when an error occurs.


---
Diffs of the changes:  (+9 -9)

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.142 llvm/lib/AsmParser/llvmAsmParser.y:1.143
--- llvm/lib/AsmParser/llvmAsmParser.y:1.142	Mon Nov 24 21:54:16 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y	Wed Nov 26 01:24:58 2003
@@ -554,10 +554,6 @@
       }
     }
 
-    // Clear the symbol table so it doesn't complain when it
-    // gets destructed
-    CurFun.LocalSymtab.clear();
-
     ThrowException("Redefinition of value named '" + Name + "' in the '" +
 		   V->getType()->getDescription() + "' type plane!");
   }
@@ -572,10 +568,6 @@
 
     // 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!");
@@ -646,7 +638,15 @@
 
   // Allocate a new module to read
   CurModule.CurrentModule = new Module(Filename);
-  yyparse();       // Parse the file.
+
+  try {
+    yyparse();       // Parse the file.
+  } catch (...) {
+    // Clear the symbol table so it doesn't complain when it
+    // gets destructed
+    CurFun.LocalSymtab.clear();
+    throw;
+  }
 
   Module *Result = ParserResult;
 





More information about the llvm-commits mailing list