Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/data/hover/.clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These fixtures contain `$(name)` hover-point annotations that clang-format
# These fixtures contain `§(name)` hover-point annotations that clang-format
# would split apart, so formatting is disabled for this directory.
DisableFormat: true
SortIncludes: false
2 changes: 1 addition & 1 deletion tests/data/hover/attributes.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Test cases ported from clangd's HoverTests.cpp (llvmorg-21.1.8), part of the LLVM project,
// licensed under Apache License v2.0 with LLVM Exceptions.

void foo(int * __attribute__((non$(01_attribute)null, noescape)) );
void foo(int * __attribute__((non§(01_attribute)null, noescape)) );
54 changes: 27 additions & 27 deletions tests/data/hover/auto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ namespace std
namespace structured_bindings {
void foo() {
struct S { int x; float y; };
au$(01_structured_bindings)to [x, y] = S();
au§(01_structured_bindings)to [x, y] = S();
}
}

// Undeduced auto.
namespace undeduced {
template<typename T>
void foo() {
au$(02_undeduced_auto)to x = T{};
au§(02_undeduced_auto)to x = T{};
}
}

// Constrained auto.
namespace constrained {
template <class T> concept F = true;
F au$(03_constrained_auto)to x = 1;
F au§(03_constrained_auto)to x = 1;
}

// auto on lambda.
namespace on_lambda {
void foo() {
au$(04_auto_lambda)to lamb = []{};
au§(04_auto_lambda)to lamb = []{};
}
}

// auto on template instantiation.
namespace on_instantiation {
template<typename T> class Foo{};
void foo() {
au$(05_auto_instantiation)to x = Foo<int>();
au§(05_auto_instantiation)to x = Foo<int>();
}
}

Expand All @@ -49,96 +49,96 @@ namespace on_specialization {
template<typename T> class Foo{};
template<> class Foo<int>{};
void foo() {
au$(06_auto_specialized)to x = Foo<int>();
au§(06_auto_specialized)to x = Foo<int>();
}
}

// Simple initialization with auto.
namespace simple_init {
void foo() {
$(07_simple_auto)auto i = 1;
§(07_simple_auto)auto i = 1;
}
}

// Simple initialization with const auto.
namespace const_init {
void foo() {
const $(08_const_auto)auto i = 1;
const §(08_const_auto)auto i = 1;
}
}

// Simple initialization with const auto&.
namespace const_ref_init {
void foo() {
const $(09_const_auto_ref)auto& i = 1;
const §(09_const_auto_ref)auto& i = 1;
}
}

// Simple initialization with auto&.
namespace ref_init {
void foo() {
int x;
$(10_auto_ref)auto& i = x;
§(10_auto_ref)auto& i = x;
}
}

// Simple initialization with auto*.
namespace ptr_init {
void foo() {
int a = 1;
$(11_auto_ptr)auto* i = &a;
§(11_auto_ptr)auto* i = &a;
}
}

// Simple initialization with auto from pointer.
namespace from_pointer {
void foo() {
int a = 1;
$(12_auto_from_pointer)auto i = &a;
§(12_auto_from_pointer)auto i = &a;
}
}

// Auto with initializer list.
namespace init_list {
void foo() {
$(13_auto_init_list)auto i = {1,2};
§(13_auto_init_list)auto i = {1,2};
}
}

// User defined conversion to auto.
namespace conversion {
struct Bar {
operator $(14_auto_conversion)auto() const { return 10; }
operator §(14_auto_conversion)auto() const { return 10; }
};
}

// Simple trailing return type.
namespace trailing_return {
$(15_auto_trailing_return)auto main() -> int {
§(15_auto_trailing_return)auto main() -> int {
return 0;
}
}

namespace trailing_decltype_return {
// auto function return with trailing type
struct Bar {};
$(16_auto_trailing_decltype)auto test() -> decltype(Bar()) {
§(16_auto_trailing_decltype)auto test() -> decltype(Bar()) {
return Bar();
}
}

namespace fn_return {
// auto in function return
struct Bar {};
$(17_auto_fn_return)auto test() {
§(17_auto_fn_return)auto test() {
return Bar();
}
}

namespace ref_fn_return {
// auto& in function return
struct Bar {};
$(18_auto_ref_fn_return)auto& test() {
§(18_auto_ref_fn_return)auto& test() {
static Bar x;
return x;
}
Expand All @@ -147,7 +147,7 @@ struct Bar {};
namespace ptr_fn_return {
// auto* in function return
struct Bar {};
$(19_auto_ptr_fn_return)auto* test() {
§(19_auto_ptr_fn_return)auto* test() {
Bar* bar;
return bar;
}
Expand All @@ -156,7 +156,7 @@ struct Bar {};
namespace const_ref_fn_return {
// const auto& in function return
struct Bar {};
const $(20_const_auto_ref_fn_return)auto& test() {
const §(20_const_auto_ref_fn_return)auto& test() {
static Bar x;
return x;
}
Expand All @@ -165,48 +165,48 @@ const $(20_const_auto_ref_fn_return)auto& test() {
// More complicated structured types.
namespace fn_pointer {
int bar();
$(21_auto_fn_pointer)auto (*foo)() = bar;
§(21_auto_fn_pointer)auto (*foo)() = bar;
}

// auto on alias.
namespace alias_int {
typedef int int_type;
$(22_auto_alias_int)auto x = int_type();
§(22_auto_alias_int)auto x = int_type();
}

namespace alias_class {
// auto on alias
struct cls {};
typedef cls cls_type;
$(23_auto_alias_class)auto y = cls_type();
§(23_auto_alias_class)auto y = cls_type();
}

namespace alias_template_inst {
// auto on alias
template <class>
struct templ {};
$(24_auto_alias_template)auto z = templ<int>();
§(24_auto_alias_template)auto z = templ<int>();
}

// Undeduced auto declaration.
namespace undeduced_decl {
template<typename T>
void foo() {
$(25_undeduced_auto_decl)auto x = T();
§(25_undeduced_auto_decl)auto x = T();
}
}

// Undeduced auto return type.
namespace undeduced_return {
template<typename T>
$(26_undeduced_auto_return)auto foo() {
§(26_undeduced_auto_return)auto foo() {
return T();
}
}

// Template auto parameter.
namespace template_auto_param {
template<a$(27_template_auto_param)uto T>
template<a§(27_template_auto_param)uto T>
void func() {
}
}
22 changes: 11 additions & 11 deletions tests/data/hover/basics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,56 @@
// licensed under Apache License v2.0 with LLVM Exceptions.

// Best foo ever.
void fo$(01_global_func)o() {}
void fo§(01_global_func)o() {}

namespace ns1 { namespace ns2 {
/// Best foo ever.
void fo$(02_ns_func)o() {}
void fo§(02_ns_func)o() {}
}}

namespace ns1 { namespace ns2 {
class Foo {
char b$(03_field)ar;
char b§(03_field)ar;
double y[2];
};
}}

union FooUnion {
char b$(04_union_field)ar;
char b§(04_union_field)ar;
double y[2];
};

struct FooBits1 {
int $(05_bitfield)x : 1;
int §(05_bitfield)x : 1;
int y : 1;
};

struct FooBits2 {
char x;
char $(06_bitfield_padding)y : 1;
char §(06_bitfield_padding)y : 1;
int z;
};

namespace ns1 { namespace ns2 {
struct Bar {
void foo() {
int b$(07_method_local)ar;
int b§(07_method_local)ar;
}
};
}}

namespace ns1 { namespace {
struct {
char b$(08_anon_struct_field)ar;
char b§(08_anon_struct_field)ar;
} T;
}}

struct $(09_struct_size)X {};
struct §(09_struct_size)X {};

void pf1() {
__f$(10_predefined_var)unc__;
__f§(10_predefined_var)unc__;
}

template<int> void pf2() {
__f$(11_predefined_var_dependent)unc__;
__f§(11_predefined_var_dependent)unc__;
}
20 changes: 10 additions & 10 deletions tests/data/hover/callee_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace fn_call {
void fun(int arg_a, int &arg_b) {};
void code() {
int a = 1, b = 2;
fun(a, $(01_arg_by_ref)b);
fun(a, §(01_arg_by_ref)b);
}
}

Expand All @@ -23,7 +23,7 @@ T make(Args&&... args)

void code() {
int a = 1;
auto foo = make<Foo>($(02_forwarded_arg)a);
auto foo = make<Foo>(§(02_forwarded_arg)a);
}
}

Expand All @@ -32,7 +32,7 @@ namespace converted_arg {
void foobar(const float &arg);
int main() {
int a = 0;
foobar($(03_converted_arg)a);
foobar(§(03_converted_arg)a);
}
}

Expand All @@ -43,7 +43,7 @@ struct Foo {
};
int main() {
int a = 0;
Foo foo($(04_converted_ctor_arg)a);
Foo foo(§(04_converted_ctor_arg)a);
}
}

Expand All @@ -52,7 +52,7 @@ namespace literal_arg {
void fun(int arg_a, const int &arg_b) {};
void code() {
int a = 1;
fun(a, $(05_literal_arg)2);
fun(a, §(05_literal_arg)2);
}
}

Expand All @@ -61,23 +61,23 @@ namespace expression_arg {
void fun(int arg_a, const int &arg_b) {};
void code() {
int a = 1;
fun(a, 1 $(06_expression_arg)+ 2);
fun(a, 1 §(06_expression_arg)+ 2);
}
}

// Expression passed by value.
namespace expression_by_value {
int add(int lhs, int rhs);
int main() {
add(1 $(07_expression_by_value)+ 2, 3);
add(1 §(07_expression_by_value)+ 2, 3);
}
}

// Literal converted to const reference parameter.
namespace converted_literal {
void foobar(const float &arg);
int main() {
foobar($(08_converted_literal)0);
foobar(§(08_converted_literal)0);
}
}

Expand All @@ -90,7 +90,7 @@ class C {
void code() {
int a = 1, b = 2;
C c;
c.fun($(09_method_arg_default)a, b);
c.fun(§(09_method_arg_default)a, b);
}
}

Expand All @@ -102,6 +102,6 @@ struct Foo {
void foo(Foo);
void bar() {
const int x = 0;
foo($(10_converting_ctor_arg)x);
foo(§(10_converting_ctor_arg)x);
}
}
Loading
Loading