Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeCompletion/desig-init.cpp @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
14 // CHECK-CC1: COMPLETION: b : [#Base#]b | 14 // CHECK-CC1: COMPLETION: b : [#Base#]b |
15 // CHECK-CC1-NEXT: COMPLETION: x : [#int#]x | 15 // CHECK-CC1-NEXT: COMPLETION: x : [#int#]x |
16 // CHECK-CC1-NOT: foo | 16 // CHECK-CC1-NOT: foo |
17 // CHECK-CC1-NOT: t | 17 // CHECK-CC1-NOT: t |
18 | 18 |
19 // FIXME: Handle nested designators | 19 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:20 %s -o - | FileCheck -check-prefix=CHECK-NESTED %s |
20 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:20 %s -o - | count 0 | 20 // CHECK-NESTED: COMPLETION: t : [#int#]t |
21 | 21 |
22 Base B = {.t = 2}; | 22 Base B = {.t = 2}; |
23 auto z = [](Base B) {}; | 23 auto z = [](Base B) {}; |
24 z({.t = 1}); | 24 z({.t = 1}); |
25 z(Base{.t = 2}); | 25 z(Base{.t = 2}); |
26 z((Base){.t = 2}); | |
26 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:22:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s | 27 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:22:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s |
27 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:7 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s | 28 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:7 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s |
28 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:25:11 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s | 29 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:25:11 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s |
30 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:26:13 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s | |
29 // CHECK-CC2: COMPLETION: t : [#int#]t | 31 // CHECK-CC2: COMPLETION: t : [#int#]t |
32 | |
33 Foo G1{.b = {.t = 0}}; | |
34 Foo G2{.b{.t = 0}}; | |
35 Foo G3{b: {.t = 0}}; | |
36 // RUN: %clang_cc1 -code-completion-at=%s:33:17 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s | |
37 // RUN: %clang_cc1 -code-completion-at=%s:34:14 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s | |
38 // RUN: %clang_cc1 -code-completion-at=%s:35:15 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s | |
39 // CHECK-NESTED-2: COMPLETION: t : [#int#]t | |
30 } | 40 } |
31 | 41 |
32 // Handle templates | 42 // Handle templates |
33 template <typename T> | 43 template <typename T> |
34 struct Test { T x; }; | 44 struct Test { T x; }; |
37 int x; | 47 int x; |
38 char y; | 48 char y; |
39 }; | 49 }; |
40 void bar() { | 50 void bar() { |
41 Test<char> T{.x = 2}; | 51 Test<char> T{.x = 2}; |
42 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:41:17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s | 52 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:51:17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s |
43 // CHECK-CC3: COMPLETION: x : [#T#]x | 53 // CHECK-CC3: COMPLETION: x : [#T#]x |
44 Test<int> X{.x = 2}; | 54 Test<int> X{.x = 2}; |
45 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:44:16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s | 55 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:54:16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s |
46 // CHECK-CC4: COMPLETION: x : [#int#]x | 56 // CHECK-CC4: COMPLETION: x : [#int#]x |
47 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y | 57 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y |
48 } | 58 } |
49 | 59 |
50 template <typename T> | 60 template <typename T> |
51 void aux() { | 61 void aux() { |
52 Test<T> X{.x = T(2)}; | 62 Test<T> X{.x = T(2)}; |
53 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:52:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s | 63 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:62:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s |
54 } | 64 } |
65 | |
66 namespace signature_regression { | |
67 // Verify that an old bug is gone: passing an init-list as a constructor arg | |
68 // would emit overloads as a side-effect. | |
69 struct S{int x;}; | |
70 int wrongFunction(S); | |
71 int rightFunction(); | |
72 int dummy = wrongFunction({1}); | |
73 int x = rightFunction(); | |
74 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:73:25 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-SIGNATURE-REGRESSION %s | |
75 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction | |
76 // CHECK-SIGNATURE-REGRESSION: OVERLOAD: [#int#]rightFunction | |
77 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction | |
78 } | |
79 |