@@ -1482,68 +1482,83 @@ TEST_F(DILocationTest, Merge) {
1482
1482
#endif
1483
1483
// Identical, including source atom numbers.
1484
1484
{
1485
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1486
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1485
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1486
+ /* AtomRank*/ 1 );
1487
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1488
+ /* AtomRank*/ 1 );
1487
1489
auto *M = DILocation::getMergedLocation (A, B);
1488
- EXPECT_ATOM (M, 1u , 1u );
1490
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , 1u );
1489
1491
// DILocations are uniqued, so we can check equality by ptr.
1490
1492
EXPECT_EQ (M, DILocation::getMergedLocation (A, B));
1491
1493
}
1492
1494
1493
1495
// Identical but different atom ranks (same atom) - choose the lowest nonzero
1494
1496
// rank.
1495
1497
{
1496
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1497
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 2 );
1498
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1499
+ /* AtomRank*/ 1 );
1500
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1501
+ /* AtomRank*/ 2 );
1498
1502
auto *M = DILocation::getMergedLocation (A, B);
1499
- EXPECT_ATOM (M, 1u , 1u );
1503
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 1u );
1500
1504
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1501
1505
1502
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 0 );
1503
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 2 );
1506
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1507
+ /* AtomRank*/ 0 );
1508
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1509
+ /* AtomRank*/ 2 );
1504
1510
M = DILocation::getMergedLocation (A, B);
1505
- EXPECT_ATOM (M, 1u , 2u );
1511
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 2u );
1506
1512
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1507
1513
}
1508
1514
1509
1515
// Identical but different atom ranks (different atom) - choose the lowest
1510
1516
// nonzero rank.
1511
1517
{
1512
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1513
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 2 );
1518
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1519
+ /* AtomRank*/ 1 );
1520
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1521
+ /* AtomRank*/ 2 );
1514
1522
auto *M = DILocation::getMergedLocation (A, B);
1515
1523
EXPECT_ATOM (M, 1u , 1u );
1516
1524
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1517
1525
1518
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 0 );
1519
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 2 );
1526
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1527
+ /* AtomRank*/ 0 );
1528
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1529
+ /* AtomRank*/ 2 );
1520
1530
M = DILocation::getMergedLocation (A, B);
1521
- EXPECT_ATOM (M, 2u , 2u );
1531
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 2u );
1522
1532
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1523
1533
}
1524
1534
1525
1535
// Identical but equal atom rank (different atom) - choose the lowest non-zero
1526
1536
// group (arbitrary choice for deterministic behaviour).
1527
1537
{
1528
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1529
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 1 );
1538
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1539
+ /* AtomRank*/ 1 );
1540
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1541
+ /* AtomRank*/ 1 );
1530
1542
auto *M = DILocation::getMergedLocation (A, B);
1531
1543
EXPECT_ATOM (M, 1u , 1u );
1532
1544
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1533
1545
1534
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 0 , 1 );
1535
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 1 );
1546
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 0 ,
1547
+ /* AtomRank*/ 1 );
1548
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1549
+ /* AtomRank*/ 1 );
1536
1550
M = DILocation::getMergedLocation (A, B);
1537
- EXPECT_ATOM (M, 2u , 1u );
1551
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 1u );
1538
1552
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1539
1553
}
1540
1554
1541
1555
// Completely different except same atom numbers. Zero out the atoms.
1542
1556
{
1543
1557
auto *I = DILocation::get (Context, 2 , 7 , N);
1544
- auto *A = DILocation::get (Context, 1 , 6 , S, I, false , 1 , 1 );
1545
- auto *B =
1546
- DILocation::get (Context, 2 , 7 , getSubprogram (), nullptr , false , 1 , 1 );
1558
+ auto *A = DILocation::get (Context, 1 , 6 , S, I, false , /* AtomGroup*/ 1 ,
1559
+ /* AtomRank*/ 1 );
1560
+ auto *B = DILocation::get (Context, 2 , 7 , getSubprogram (), nullptr , false ,
1561
+ /* AtomGroup*/ 1 , /* AtomRank*/ 1 );
1547
1562
auto *M = DILocation::getMergedLocation (A, B);
1548
1563
EXPECT_EQ (0u , M->getLine ());
1549
1564
EXPECT_EQ (0u , M->getColumn ());
@@ -1557,16 +1572,20 @@ TEST_F(DILocationTest, Merge) {
1557
1572
{
1558
1573
auto *I = DILocation::get (Context, 1 , 7 , N);
1559
1574
auto *F = getSubprogram ();
1560
- auto *A = DILocation::get (Context, 1 , 1 , F, I, false , 1 , 2 );
1561
- auto *B = DILocation::get (Context, 1 , 1 , F, I, false , 2 , 1 );
1575
+ auto *A = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 1 ,
1576
+ /* AtomRank*/ 2 );
1577
+ auto *B = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 2 ,
1578
+ /* AtomRank*/ 1 );
1562
1579
auto *M = DILocation::getMergedLocation (A, B);
1563
- EXPECT_ATOM (M, 2u , 1u );
1580
+ EXPECT_ATOM (M, 2u , /* AtomRank */ 1u );
1564
1581
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1565
1582
1566
- A = DILocation::get (Context, 1 , 1 , F, I, false , 1 , 2 );
1567
- B = DILocation::get (Context, 1 , 1 , F, I, false , 2 , 0 );
1583
+ A = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 1 ,
1584
+ /* AtomRank*/ 2 );
1585
+ B = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 2 ,
1586
+ /* AtomRank*/ 0 );
1568
1587
M = DILocation::getMergedLocation (A, B);
1569
- EXPECT_ATOM (M, 1u , 2u );
1588
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 2u );
1570
1589
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1571
1590
}
1572
1591
@@ -1582,24 +1601,25 @@ TEST_F(DILocationTest, Merge) {
1582
1601
auto *FY = getSubprogram ();
1583
1602
auto *FZ = getSubprogram ();
1584
1603
auto *Z4 = DILocation::get (Context, 1 , 4 , FZ);
1585
- auto *Y3IntoZ4 = DILocation::get (Context, 1 , 3 , FY, Z4, false , 1 , 1 );
1604
+ auto *Y3IntoZ4 = DILocation::get (Context, 1 , 3 , FY, Z4, false ,
1605
+ /* AtomGroup*/ 1 , /* AtomRank*/ 1 );
1586
1606
auto *Y2IntoZ4 = DILocation::get (Context, 1 , 2 , FY, Z4);
1587
1607
auto *X1IntoY2 = DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4);
1588
1608
auto *M = DILocation::getMergedLocation (X1IntoY2, Y3IntoZ4);
1589
1609
EXPECT_EQ (M->getScope (), FY);
1590
1610
EXPECT_EQ (M->getInlinedAt ()->getScope (), FZ);
1591
- EXPECT_ATOM (M, 2u , 1u );
1611
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 1u );
1592
1612
1593
1613
// This swapped merge will produce a new atom group too.
1594
1614
M = DILocation::getMergedLocation (Y3IntoZ4, X1IntoY2);
1595
1615
1596
1616
// Same again, even if the atom numbers match.
1597
- auto *X1IntoY2SameAtom =
1598
- DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4, false , 1 , 1 );
1617
+ auto *X1IntoY2SameAtom = DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4, false ,
1618
+ /* AtomGroup */ 1 , /* AtomRank */ 1 );
1599
1619
M = DILocation::getMergedLocation (X1IntoY2SameAtom, Y3IntoZ4);
1600
- EXPECT_ATOM (M, 4u , 1u );
1620
+ EXPECT_ATOM (M, /* AtomGroup */ 4u , /* AtomRank */ 1u );
1601
1621
M = DILocation::getMergedLocation (Y3IntoZ4, X1IntoY2SameAtom);
1602
- EXPECT_ATOM (M, 5u , 1u );
1622
+ EXPECT_ATOM (M, /* AtomGroup */ 5u , /* AtomRank */ 1u );
1603
1623
}
1604
1624
#undef EXPECT_ATOM
1605
1625
}
0 commit comments