mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Add some extra checks. Opaque types don't have a null marker.
llvm-svn: 21700
This commit is contained in:
parent
f83598edd5
commit
c390fbea0d
@ -412,9 +412,12 @@ Value * BytecodeReader::getValue(unsigned type, unsigned oNum, bool Create) {
|
|||||||
GlobalTyID = CompactionTypes[type-Type::FirstDerivedTyID].second;
|
GlobalTyID = CompactionTypes[type-Type::FirstDerivedTyID].second;
|
||||||
|
|
||||||
if (hasImplicitNull(GlobalTyID)) {
|
if (hasImplicitNull(GlobalTyID)) {
|
||||||
if (Num == 0)
|
const Type *Ty = getType(type);
|
||||||
return Constant::getNullValue(getType(type));
|
if (!isa<OpaqueType>(Ty)) {
|
||||||
--Num;
|
if (Num == 0)
|
||||||
|
return Constant::getNullValue(Ty);
|
||||||
|
--Num;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GlobalTyID < ModuleValues.size() && ModuleValues[GlobalTyID]) {
|
if (GlobalTyID < ModuleValues.size() && ModuleValues[GlobalTyID]) {
|
||||||
@ -529,7 +532,7 @@ unsigned BytecodeReader::insertValue(Value *Val, unsigned type,
|
|||||||
|
|
||||||
ValueTab[type]->push_back(Val);
|
ValueTab[type]->push_back(Val);
|
||||||
|
|
||||||
bool HasOffset = hasImplicitNull(type);
|
bool HasOffset = hasImplicitNull(type) && !isa<OpaqueType>(Val->getType());
|
||||||
return ValueTab[type]->size()-1 + HasOffset;
|
return ValueTab[type]->size()-1 + HasOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2141,6 +2144,9 @@ void BytecodeReader::ParseModule() {
|
|||||||
error("Cannot find initializer value.");
|
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
|
/// Make sure we pulled them all out. If we didn't then there's a declaration
|
||||||
/// but a missing body. That's not allowed.
|
/// but a missing body. That's not allowed.
|
||||||
if (!FunctionSignatureList.empty())
|
if (!FunctionSignatureList.empty())
|
||||||
|
Loading…
Reference in New Issue
Block a user