Clang Project

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