[opaque pointer types] Remove some calls to generic Type subtype accessors.
That is, remove many of the calls to Type::getNumContainedTypes(), Type::subtypes(), and Type::getContainedType(N). I'm not intending to remove these accessors -- they are useful/necessary in some cases. However, removing the pointee type from pointers would potentially break some uses, and reducing the number of calls makes it easier to audit. llvm-svn: 350835
This commit is contained in:
@@ -3720,16 +3720,16 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
|
||||
return error("EXTRACTVAL: Invalid type");
|
||||
if ((unsigned)Index != Index)
|
||||
return error("Invalid value");
|
||||
if (IsStruct && Index >= CurTy->subtypes().size())
|
||||
if (IsStruct && Index >= CurTy->getStructNumElements())
|
||||
return error("EXTRACTVAL: Invalid struct index");
|
||||
if (IsArray && Index >= CurTy->getArrayNumElements())
|
||||
return error("EXTRACTVAL: Invalid array index");
|
||||
EXTRACTVALIdx.push_back((unsigned)Index);
|
||||
|
||||
if (IsStruct)
|
||||
CurTy = CurTy->subtypes()[Index];
|
||||
CurTy = CurTy->getStructElementType(Index);
|
||||
else
|
||||
CurTy = CurTy->subtypes()[0];
|
||||
CurTy = CurTy->getArrayElementType();
|
||||
}
|
||||
|
||||
I = ExtractValueInst::Create(Agg, EXTRACTVALIdx);
|
||||
@@ -3762,16 +3762,16 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
|
||||
return error("INSERTVAL: Invalid type");
|
||||
if ((unsigned)Index != Index)
|
||||
return error("Invalid value");
|
||||
if (IsStruct && Index >= CurTy->subtypes().size())
|
||||
if (IsStruct && Index >= CurTy->getStructNumElements())
|
||||
return error("INSERTVAL: Invalid struct index");
|
||||
if (IsArray && Index >= CurTy->getArrayNumElements())
|
||||
return error("INSERTVAL: Invalid array index");
|
||||
|
||||
INSERTVALIdx.push_back((unsigned)Index);
|
||||
if (IsStruct)
|
||||
CurTy = CurTy->subtypes()[Index];
|
||||
CurTy = CurTy->getStructElementType(Index);
|
||||
else
|
||||
CurTy = CurTy->subtypes()[0];
|
||||
CurTy = CurTy->getArrayElementType();
|
||||
}
|
||||
|
||||
if (CurTy != Val->getType())
|
||||
|
||||
Reference in New Issue
Block a user