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

LLVM llvm at cs.uiuc.edu
Sat Jul 17 17:12:13 PDT 2004



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.115 -> 1.116

---
Log message:

bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass


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

Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.115 llvm/lib/Bytecode/Reader/Reader.cpp:1.116
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.115	Wed Jul 14 15:33:13 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Sat Jul 17 19:12:03 2004
@@ -425,12 +425,9 @@
   if (Value *V = getValue(TypeSlot, Slot, false))
     if (Constant *C = dyn_cast<Constant>(V))
       return C;   // If we already have the value parsed, just return it
-    else if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
-      // ConstantPointerRef's are an abomination, but at least they don't have
-      // to infest bytecode files.
-      return ConstantPointerRef::get(GV);
     else
-      error("Reference of a value is expected to be a constant!");
+      error("Value for slot " + utostr(Slot) + 
+            " is expected to be a constant!");
 
   const Type *Ty = getType(TypeSlot);
   std::pair<const Type*, unsigned> Key(Ty, Slot);
@@ -1356,14 +1353,13 @@
     GlobalValue *GV;
     if (Val) {
       if (!(GV = dyn_cast<GlobalValue>(Val))) 
-        error("Value of ConstantPointerRef not in ValueTable!");
+        error("GlobalValue not in ValueTable!");
     } else {
       error("Forward references are not allowed here.");
     }
     
-    Constant* Result = ConstantPointerRef::get(GV);
-    if (Handler) Handler->handleConstantPointer(PT, Slot, GV, Result);
-    return Result;
+    if (Handler) Handler->handleConstantPointer(PT, Slot, GV );
+    return GV;
   }
 
   default:





More information about the llvm-commits mailing list