[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu May 5 13:57:17 PDT 2005
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.157 -> 1.158
---
Log message:
Add some extra checks. Opaque types don't have a null marker.
---
Diffs of the changes: (+10 -4)
Reader.cpp | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.157 llvm/lib/Bytecode/Reader/Reader.cpp:1.158
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.157 Thu Apr 21 16:44:41 2005
+++ llvm/lib/Bytecode/Reader/Reader.cpp Thu May 5 15:57:00 2005
@@ -412,9 +412,12 @@
GlobalTyID = CompactionTypes[type-Type::FirstDerivedTyID].second;
if (hasImplicitNull(GlobalTyID)) {
- if (Num == 0)
- return Constant::getNullValue(getType(type));
- --Num;
+ const Type *Ty = getType(type);
+ if (!isa<OpaqueType>(Ty)) {
+ if (Num == 0)
+ return Constant::getNullValue(Ty);
+ --Num;
+ }
}
if (GlobalTyID < ModuleValues.size() && ModuleValues[GlobalTyID]) {
@@ -529,7 +532,7 @@
ValueTab[type]->push_back(Val);
- bool HasOffset = hasImplicitNull(type);
+ bool HasOffset = hasImplicitNull(type) && !isa<OpaqueType>(Val->getType());
return ValueTab[type]->size()-1 + HasOffset;
}
@@ -2141,6 +2144,9 @@
error("Cannot find initializer value.");
}
+ if (!ConstantFwdRefs.empty())
+ error("Use of undefined constants in a module");
+
/// Make sure we pulled them all out. If we didn't then there's a declaration
/// but a missing body. That's not allowed.
if (!FunctionSignatureList.empty())
More information about the llvm-commits
mailing list