[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeCompletion / function-overloads.cpp
blob7b8ccef1d580fd07c12ff32292ba10cc9b65eff4
1 int f(int i, int j = 2, int k = 5);
2 int f(float x, float y...);
4 class A {
5 public:
6 A(int, int, int);
7 };
9 void test() {
10 A a(f(1, 2, 3, 4), 2, 3);
14 namespace NS {
15 struct X { };
16 struct Y { Y(X); };
17 template <class T = int>
18 void g(X, Y);
21 void test_adl() {
22 NS::X x;
23 g(x, x);
24 (void)(f)(1, 2, 3);
25 (void)(test, test, test, f)(1, 2, 3);
28 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
29 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:10 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
30 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:17 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
31 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:19 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
32 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:20 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
33 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:21 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
34 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:7 %s -o - | \
35 // RUN: FileCheck -check-prefix=CHECK-CC5 %s
36 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:24:13 %s -o - | \
37 // RUN: FileCheck -check-prefix=CHECK-CC1 %s
38 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:25:31 %s -o - | \
39 // RUN: FileCheck -check-prefix=CHECK-CC1 %s
40 // CHECK-CC1: OVERLOAD: [#int#]f(<#float x#>, float y)
41 // CHECK-CC1: OVERLOAD: [#int#]f(<#int i#>)
42 // CHECK-CC1-NOT, CHECK-CC2-NOT: OVERLOAD: A(
43 // CHECK-CC2: OVERLOAD: [#int#]f(float x, float y)
44 // CHECK-CC2-NOT: OVERLOAD: [#int#]f(int i)
45 // CHECK-CC3: OVERLOAD: A(<#int#>, int, int)
46 // CHECK-CC3: OVERLOAD: A(<#const A &#>)
47 // CHECK-CC3: OVERLOAD: A(<#A &&#>)
48 // CHECK-CC4: OVERLOAD: A(int, <#int#>, int)
49 // CHECK-CC5: OVERLOAD: [#void#]g(X, <#Y#>)