mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-12 14:06:36 +00:00
Anonymous definitions in foreach blocks triggered a 'def already exists'
llvm-svn: 210526
This commit is contained in:
parent
8d5e97704b
commit
99252b5c50
@ -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);
|
||||
|
@ -51,8 +51,10 @@ foreach i = [0, 1, 2, 3, 4, 5, 6, 7] in
|
||||
// CHECK: string Name = "R7";
|
||||
// CHECK: int Index = 7;
|
||||
|
||||
foreach i = {0-3,9-7} in
|
||||
foreach i = {0-3,9-7} in {
|
||||
def S#i : Register<"Q"#i, i>;
|
||||
def : Register<"T"#i, i>;
|
||||
}
|
||||
|
||||
// CHECK: def S0
|
||||
// CHECK: def S1
|
||||
@ -61,3 +63,25 @@ foreach i = {0-3,9-7} in
|
||||
// CHECK: def S7
|
||||
// CHECK: def S8
|
||||
// CHECK: def S9
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T0";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T1";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T2";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T3";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T9";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T8";
|
||||
|
||||
// CHECK: def
|
||||
// CHECK: string Name = "T7";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user