Anonymous definitions in foreach blocks triggered a 'def already exists'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210526 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Artyom Skrobov
2014-06-10 12:41:14 +00:00
parent e1db6ac10b
commit 2093e88d67
2 changed files with 32 additions and 3 deletions

View File

@ -360,8 +360,13 @@ bool TGParser::ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals){
}
if (Records.getDef(IterRec->getNameInitAsString())) {
Error(Loc, "def already exists: " + IterRec->getNameInitAsString());
return true;
// If this record is anonymous, it's no problem, just generate a new name
if (IterRec->isAnonymous())
IterRec->setName(GetNewAnonymousName());
else {
Error(Loc, "def already exists: " + IterRec->getNameInitAsString());
return true;
}
}
Records.addDef(IterRec);