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

Chris Lattner sabre at nondot.org
Mon Apr 23 09:04:28 PDT 2007



Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.1 -> 1.2
---
Log message:

first part of implementation of abbrevs.  The writer isn't fully there yet and the
reader doesn't handle them at all yet.


---
Diffs of the changes:  (+8 -6)

 BitcodeReader.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.1 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.2
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.1	Sun Apr 22 01:23:29 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp	Mon Apr 23 11:04:05 2007
@@ -93,7 +93,7 @@
       continue;
     }
     
-    if (Code == bitc::DEFINE_ABBREVS) {
+    if (Code == bitc::DEFINE_ABBREV) {
       assert(0 && "Abbrevs not implemented yet!");
     }
     
@@ -230,7 +230,7 @@
       continue;
     }
     
-    if (Code == bitc::DEFINE_ABBREVS) {
+    if (Code == bitc::DEFINE_ABBREV) {
       assert(0 && "Abbrevs not implemented yet!");
     }
     
@@ -293,7 +293,7 @@
       continue;
     }
     
-    if (Code == bitc::DEFINE_ABBREVS) {
+    if (Code == bitc::DEFINE_ABBREV) {
       assert(0 && "Abbrevs not implemented yet!");
     }
     
@@ -345,7 +345,7 @@
     // GLOBALVAR: [type, isconst, initid, 
     //             linkage, alignment, section, visibility, threadlocal]
     case bitc::MODULE_CODE_GLOBALVAR: {
-      if (Record.size() < 8)
+      if (Record.size() < 6)
         return Error("Invalid MODULE_CODE_GLOBALVAR record");
       const Type *Ty = getTypeByID(Record[0]);
       if (!isa<PointerType>(Ty))
@@ -361,8 +361,10 @@
           return Error("Invalid section ID");
         Section = SectionTable[Record[5]-1];
       }
-      GlobalValue::VisibilityTypes Visibility = GetDecodedVisibility(Record[6]);
-      bool isThreadLocal = Record[7];
+      GlobalValue::VisibilityTypes Visibility = GlobalValue::DefaultVisibility;
+      if (Record.size() >= 6) Visibility = GetDecodedVisibility(Record[6]);
+      bool isThreadLocal = false;
+      if (Record.size() >= 7) isThreadLocal = Record[7];
 
       GlobalVariable *NewGV =
         new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule);






More information about the llvm-commits mailing list