@@ -580,7 +580,12 @@ class Foo {})cpp";
580
580
Annotations T (Case.Code );
581
581
TestTU TU = TestTU::withCode (T.code ());
582
582
TU.ExtraArgs .push_back (" -std=c++17" );
583
+ // FIXME: This is no longer necessary, as the default behavior is no delayed
584
+ // parsing in the triplet below.
583
585
TU.ExtraArgs .push_back (" -fno-delayed-template-parsing" );
586
+ // Types might be different depending on the target triplet, we chose a
587
+ // fixed one to make sure tests passes on different platform.
588
+ TU.ExtraArgs .push_back (" --target=x86_64-pc-linux-gnu" );
584
589
auto AST = TU.build ();
585
590
586
591
auto H = getHover (AST, T.point (), format::getLLVMStyle (), nullptr );
@@ -1587,6 +1592,26 @@ TEST(Hover, All) {
1587
1592
HI.Parameters = {
1588
1593
{std::string (" int" ), std::string (" x" ), llvm::None}};
1589
1594
}},
1595
+ {
1596
+ R"cpp( // sizeof expr
1597
+ void foo() {
1598
+ (void)[[size^of]](char);
1599
+ })cpp" ,
1600
+ [](HoverInfo &HI) {
1601
+ HI.Name = " expression" ;
1602
+ HI.Type = " unsigned long" ;
1603
+ HI.Value = " 1" ;
1604
+ }},
1605
+ {
1606
+ R"cpp( // alignof expr
1607
+ void foo() {
1608
+ (void)[[align^of]](char);
1609
+ })cpp" ,
1610
+ [](HoverInfo &HI) {
1611
+ HI.Name = " expression" ;
1612
+ HI.Type = " unsigned long" ;
1613
+ HI.Value = " 1" ;
1614
+ }},
1590
1615
};
1591
1616
1592
1617
// Create a tiny index, so tests above can verify documentation is fetched.
@@ -1604,6 +1629,9 @@ TEST(Hover, All) {
1604
1629
TestTU TU = TestTU::withCode (T.code ());
1605
1630
TU.ExtraArgs .push_back (" -std=c++17" );
1606
1631
TU.ExtraArgs .push_back (" -Wno-gnu-designator" );
1632
+ // Types might be different depending on the target triplet, we chose a
1633
+ // fixed one to make sure tests passes on different platform.
1634
+ TU.ExtraArgs .push_back (" --target=x86_64-pc-linux-gnu" );
1607
1635
auto AST = TU.build ();
1608
1636
1609
1637
auto H = getHover (AST, T.point (), format::getLLVMStyle (), Index.get ());
@@ -1836,46 +1864,6 @@ Value = val
1836
1864
def)pt" ;
1837
1865
EXPECT_EQ (HI.present ().asPlainText (), ExpectedPlaintext);
1838
1866
}
1839
-
1840
- TEST (Hover, ExprTests) {
1841
- struct {
1842
- const char *const Code;
1843
- const std::function<void (HoverInfo &)> ExpectedBuilder;
1844
- } Cases[] = {
1845
- {
1846
- R"cpp( // sizeof expr
1847
- void foo() {
1848
- (void)[[size^of]](char);
1849
- })cpp" ,
1850
- [](HoverInfo &HI) {
1851
- HI.Name = " expression" ;
1852
- HI.Type = " unsigned long" ;
1853
- HI.Value = " 1" ;
1854
- }},
1855
- {
1856
- R"cpp( // alignof expr
1857
- void foo() {
1858
- (void)[[align^of]](char);
1859
- })cpp" ,
1860
- [](HoverInfo &HI) {
1861
- HI.Name = " expression" ;
1862
- HI.Type = " unsigned long" ;
1863
- HI.Value = " 1" ;
1864
- }},
1865
- };
1866
- for (const auto &C : Cases) {
1867
- Annotations T (C.Code );
1868
- TestTU TU = TestTU::withCode (T.code ());
1869
- auto AST = TU.build ();
1870
- auto H = getHover (AST, T.point (), format::getLLVMStyle (), nullptr );
1871
- ASSERT_TRUE (H);
1872
- HoverInfo ExpectedHover;
1873
- C.ExpectedBuilder (ExpectedHover);
1874
- // We don't check for Type as it might differ on different platforms.
1875
- EXPECT_EQ (H->Name , ExpectedHover.Name );
1876
- EXPECT_EQ (H->Value , ExpectedHover.Value );
1877
- }
1878
- }
1879
1867
} // namespace
1880
1868
} // namespace clangd
1881
1869
} // namespace clang
0 commit comments