[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Dec 3 21:28:40 PST 2004



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.144 -> 1.145
---
Log message:

Do not allow bytecode files with unresolved references to be read.  Doing 
so lets wierd ConstantPlaceholder objects sneak into the system which 
confuses it greatly.


---
Diffs of the changes:  (+7 -1)

Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.144 llvm/lib/Bytecode/Reader/Reader.cpp:1.145
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.144	Tue Nov 30 10:58:18 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Fri Dec  3 23:28:27 2004
@@ -1312,7 +1312,7 @@
     // Construct a ConstantExpr of the appropriate kind
     if (isExprNumArgs == 1) {           // All one-operand expressions
       if (Opcode != Instruction::Cast)
-        error("Only Cast instruction has one argument for ConstantExpr");
+        error("Only cast instruction has one argument for ConstantExpr");
 
       Constant* Result = ConstantExpr::getCast(ArgVec[0], getType(TypeID));
       if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
@@ -1568,6 +1568,12 @@
       }
     }
   }
+
+  // After we have finished parsing the constant pool, we had better not have
+  // any dangling references left.
+  if (!ConstantFwdRefs.empty())
+    error("Unresolved constant references exist!");
+
   checkPastBlockEnd("Constant Pool");
   if (Handler) Handler->handleGlobalConstantsEnd();
 }






More information about the llvm-commits mailing list