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

Chris Lattner sabre at nondot.org
Mon Apr 23 17:22:03 PDT 2007



Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.5 -> 1.6
---
Log message:

move check to the right place :)


---
Diffs of the changes:  (+4 -3)

 BitcodeReader.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.5 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.6
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.5	Mon Apr 23 19:18:21 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp	Mon Apr 23 19:21:45 2007
@@ -322,8 +322,11 @@
   // Read all the records for this module.
   while (!Stream.AtEndOfStream()) {
     unsigned Code = Stream.ReadCode();
-    if (Code == bitc::END_BLOCK)
+    if (Code == bitc::END_BLOCK) {
+      if (!GlobalInits.empty())
+        return Error("Malformed global initializer set");
       return Stream.ReadBlockEnd();
+    }
     
     if (Code == bitc::ENTER_SUBBLOCK) {
       switch (Stream.ReadSubBlockID()) {
@@ -358,8 +361,6 @@
     case bitc::MODULE_CODE_VERSION:  // VERSION: [version#]
       if (Record.size() < 1)
         return Error("Malformed MODULE_CODE_VERSION");
-      if (!GlobalInits.empty())
-        return Error("Malformed global initializer set");
       // Only version #0 is supported so far.
       if (Record[0] != 0)
         return Error("Unknown bitstream version!");






More information about the llvm-commits mailing list