@@ -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
ASSERT_TRUE (AST.getDiagnostics ().empty ());
586
591
@@ -1590,6 +1595,26 @@ TEST(Hover, All) {
1590
1595
HI.Parameters = {
1591
1596
{std::string (" int" ), std::string (" x" ), llvm::None}};
1592
1597
}},
1598
+ {
1599
+ R"cpp( // sizeof expr
1600
+ void foo() {
1601
+ (void)[[size^of]](char);
1602
+ })cpp" ,
1603
+ [](HoverInfo &HI) {
1604
+ HI.Name = " expression" ;
1605
+ HI.Type = " unsigned long" ;
1606
+ HI.Value = " 1" ;
1607
+ }},
1608
+ {
1609
+ R"cpp( // alignof expr
1610
+ void foo() {
1611
+ (void)[[align^of]](char);
1612
+ })cpp" ,
1613
+ [](HoverInfo &HI) {
1614
+ HI.Name = " expression" ;
1615
+ HI.Type = " unsigned long" ;
1616
+ HI.Value = " 1" ;
1617
+ }},
1593
1618
};
1594
1619
1595
1620
// Create a tiny index, so tests above can verify documentation is fetched.
@@ -1607,6 +1632,9 @@ TEST(Hover, All) {
1607
1632
TestTU TU = TestTU::withCode (T.code ());
1608
1633
TU.ExtraArgs .push_back (" -std=c++17" );
1609
1634
TU.ExtraArgs .push_back (" -Wno-gnu-designator" );
1635
+ // Types might be different depending on the target triplet, we chose a
1636
+ // fixed one to make sure tests passes on different platform.
1637
+ TU.ExtraArgs .push_back (" --target=x86_64-pc-linux-gnu" );
1610
1638
auto AST = TU.build ();
1611
1639
for (const auto &D : AST.getDiagnostics ())
1612
1640
ADD_FAILURE () << D;
@@ -1854,49 +1882,6 @@ Value = val
1854
1882
def)pt" ;
1855
1883
EXPECT_EQ (HI.present ().asPlainText (), ExpectedPlaintext);
1856
1884
}
1857
-
1858
- TEST (Hover, ExprTests) {
1859
- struct {
1860
- const char *const Code;
1861
- const std::function<void (HoverInfo &)> ExpectedBuilder;
1862
- } Cases[] = {
1863
- {
1864
- R"cpp( // sizeof expr
1865
- void foo() {
1866
- (void)[[size^of]](char);
1867
- })cpp" ,
1868
- [](HoverInfo &HI) {
1869
- HI.Name = " expression" ;
1870
- HI.Type = " unsigned long" ;
1871
- HI.Value = " 1" ;
1872
- }},
1873
- {
1874
- R"cpp( // alignof expr
1875
- void foo() {
1876
- (void)[[align^of]](char);
1877
- })cpp" ,
1878
- [](HoverInfo &HI) {
1879
- HI.Name = " expression" ;
1880
- HI.Type = " unsigned long" ;
1881
- HI.Value = " 1" ;
1882
- }},
1883
- };
1884
- for (const auto &C : Cases) {
1885
- Annotations T (C.Code );
1886
- TestTU TU = TestTU::withCode (T.code ());
1887
- auto AST = TU.build ();
1888
- for (const auto &D : AST.getDiagnostics ())
1889
- ADD_FAILURE () << D;
1890
-
1891
- auto H = getHover (AST, T.point (), format::getLLVMStyle (), nullptr );
1892
- ASSERT_TRUE (H);
1893
- HoverInfo ExpectedHover;
1894
- C.ExpectedBuilder (ExpectedHover);
1895
- // We don't check for Type as it might differ on different platforms.
1896
- EXPECT_EQ (H->Name , ExpectedHover.Name );
1897
- EXPECT_EQ (H->Value , ExpectedHover.Value );
1898
- }
1899
- }
1900
1885
} // namespace
1901
1886
} // namespace clangd
1902
1887
} // namespace clang
0 commit comments