You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[OpenACC] Fix checking of sub-expressions in cache
Running an external test suite (UDel) showed that our expression
comparison for the 'cache' rule checking was overly strict in the
presence of irrelevant parens/casts/etc. This patch ensures we skip
them when checking.
This also changes the diagnostic to say 'sub-expression' instead of
variable, which is more correct.
Copy file name to clipboardExpand all lines: clang/test/SemaOpenACC/atomic-construct.cpp
+34-18Lines changed: 34 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1098,7 +1098,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1098
1098
{
1099
1099
LHS--;
1100
1100
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1101
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used in unary expression('LHS') from the first statement}}
1101
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}
1102
1102
LHS = RHS;
1103
1103
}
1104
1104
@@ -1128,7 +1128,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1128
1128
{
1129
1129
LHS *= 1;
1130
1130
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1131
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of compound assignment('LHS') from the first statement}}
1131
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}
1132
1132
LHS = RHS;
1133
1133
}
1134
1134
#pragma acc atomic capture
@@ -1157,7 +1157,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1157
1157
{
1158
1158
LHS = LHS * 1;
1159
1159
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1160
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1160
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1161
1161
RHS = RHS;
1162
1162
}
1163
1163
#pragma acc atomic capture
@@ -1186,7 +1186,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1186
1186
{
1187
1187
LHS = LHS | 1;
1188
1188
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1189
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1189
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1190
1190
RHS = RHS;
1191
1191
}
1192
1192
#pragma acc atomic capture
@@ -1255,7 +1255,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1255
1255
{
1256
1256
LHS = RHS;
1257
1257
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1258
-
// expected-note@+1{{variable on left hand side of assignment('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1258
+
// expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1259
1259
LHS = 1;
1260
1260
}
1261
1261
@@ -1294,7 +1294,7 @@ void AtomicCaptureTemplateCompound(T LHS, T RHS) {
1294
1294
{
1295
1295
LHS = RHS;
1296
1296
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1297
-
// expected-note@+1{{variable in unary expression('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1297
+
// expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1298
1298
LHS++;
1299
1299
}
1300
1300
}
@@ -1352,7 +1352,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1352
1352
{
1353
1353
LHS--;
1354
1354
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1355
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used in unary expression('LHS') from the first statement}}
1355
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}
1356
1356
LHS = RHS;
1357
1357
}
1358
1358
@@ -1384,7 +1384,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1384
1384
{
1385
1385
LHS *= 1;
1386
1386
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1387
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of compound assignment('LHS') from the first statement}}
1387
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}
1388
1388
LHS = RHS;
1389
1389
}
1390
1390
#pragma acc atomic capture
@@ -1415,7 +1415,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1415
1415
{
1416
1416
LHS = LHS * 1;
1417
1417
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1418
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1418
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1419
1419
RHS = RHS;
1420
1420
}
1421
1421
#pragma acc atomic capture
@@ -1446,7 +1446,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1446
1446
{
1447
1447
LHS = LHS | 1;
1448
1448
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1449
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1449
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1450
1450
RHS = RHS;
1451
1451
}
1452
1452
#pragma acc atomic capture
@@ -1523,7 +1523,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1523
1523
{
1524
1524
LHS = RHS;
1525
1525
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1526
-
// expected-note@+1{{variable on left hand side of assignment('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1526
+
// expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1527
1527
LHS = 1;
1528
1528
}
1529
1529
@@ -1570,7 +1570,7 @@ void AtomicCaptureTemplateCompound2(T LHS, T RHS) {
1570
1570
{
1571
1571
LHS = RHS;
1572
1572
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1573
-
// expected-note@+1{{variable in unary expression('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1573
+
// expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1574
1574
LHS++;
1575
1575
}
1576
1576
}
@@ -1629,7 +1629,7 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1629
1629
{
1630
1630
LHS--;
1631
1631
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1632
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used in unary expression('LHS') from the first statement}}
1632
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}
1633
1633
LHS = RHS;
1634
1634
}
1635
1635
@@ -1666,7 +1666,7 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1666
1666
{
1667
1667
LHS *= 1;
1668
1668
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1669
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of compound assignment('LHS') from the first statement}}
1669
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}
1670
1670
LHS = RHS;
1671
1671
}
1672
1672
#pragma acc atomic capture
@@ -1702,7 +1702,7 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1702
1702
{
1703
1703
LHS = LHS * 1;
1704
1704
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1705
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1705
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1706
1706
RHS = RHS;
1707
1707
}
1708
1708
#pragma acc atomic capture
@@ -1738,7 +1738,7 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1738
1738
{
1739
1739
LHS = LHS | 1;
1740
1740
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1741
-
// expected-note@+1{{variable on right hand side of assignment('RHS') must match variable used on left hand side of assignment('LHS') from the first statement}}
1741
+
// expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}
1742
1742
RHS = RHS;
1743
1743
}
1744
1744
#pragma acc atomic capture
@@ -1815,7 +1815,7 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1815
1815
{
1816
1816
LHS = RHS;
1817
1817
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1818
-
// expected-note@+1{{variable on left hand side of assignment('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1818
+
// expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1819
1819
LHS = 1;
1820
1820
}
1821
1821
@@ -1861,7 +1861,23 @@ void AtomicCaptureCompound(int LHS, int RHS) {
1861
1861
{
1862
1862
LHS = RHS;
1863
1863
// expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}
1864
-
// expected-note@+1{{variable in unary expression('LHS') must match variable used on right hand side of assignment('RHS') from the first statement}}
1864
+
// expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}
1865
1865
LHS++;
1866
1866
}
1867
+
1868
+
// Example from UDel test suite, which wasn't working because of irrelevant
1869
+
// parens, make sure we work with these. This should not diagnose.
0 commit comments