reject PR3281:crash09.ll with this diagnostic:

llvm-as: crash09.ll:3:1: self referential type is invalid
type %0
^

llvm-svn: 61720
This commit is contained in:
Chris Lattner 2009-01-05 18:19:46 +00:00
parent 5261c8923f
commit 651252b019
1 changed files with 6 additions and 0 deletions

View File

@ -238,6 +238,9 @@ bool LLParser::ParseUnnamedType() {
std::map<unsigned, std::pair<PATypeHolder, LocTy> >::iterator
FI = ForwardRefTypeIDs.find(TypeID);
if (FI != ForwardRefTypeIDs.end()) {
if (FI->second.first.get() == Ty)
return Error(TypeLoc, "self referential type is invalid");
cast<DerivedType>(FI->second.first.get())->refineAbstractTypeTo(Ty);
Ty = FI->second.first.get();
ForwardRefTypeIDs.erase(FI);
@ -275,6 +278,9 @@ bool LLParser::ParseNamedType() {
std::map<std::string, std::pair<PATypeHolder, LocTy> >::iterator
FI = ForwardRefTypes.find(Name);
if (FI != ForwardRefTypes.end()) {
if (FI->second.first.get() == Ty)
return Error(NameLoc, "self referential type is invalid");
cast<DerivedType>(FI->second.first.get())->refineAbstractTypeTo(Ty);
Ty = FI->second.first.get();
ForwardRefTypes.erase(FI);