Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeCompletion/desig-init.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
7 void foo(); | 7 void foo(); |
8 }; | 8 }; |
9 | 9 |
10 void foo() { | 10 void foo() { |
11 Foo F{.x = 2, .b.t = 0}; | 11 Foo F{.x = 2, .b.t = 0}; |
12 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:10 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s | 12 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):10 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s |
13 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:18 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s | 13 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-2):18 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s |
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 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:20 %s -o - | FileCheck -check-prefix=CHECK-NESTED %s | 19 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-8):20 %s -o - | FileCheck -check-prefix=CHECK-NESTED %s |
20 // CHECK-NESTED: COMPLETION: t : [#int#]t | 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 z((Base){.t = 2}); |
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:%(line-5):14 %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:%(line-4):7 %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 | 29 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):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 | 30 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):13 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s |
31 // CHECK-CC2: COMPLETION: t : [#int#]t | 31 // CHECK-CC2: COMPLETION: t : [#int#]t |
32 auto zr = [](const Base &B) {}; | |
33 zr({.t = 1}); | |
34 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):8 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-REF %s | |
35 // CHECK-REF: COMPLETION: t : [#int#]t | |
32 | 36 |
33 Foo G1{.b = {.t = 0}}; | 37 Foo G1{.b = {.t = 0}}; |
34 Foo G2{.b{.t = 0}}; | 38 Foo G2{.b{.t = 0}}; |
35 Foo G3{b: {.t = 0}}; | 39 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 | 40 // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):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 | 41 // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):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 | 42 // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):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 | 43 // CHECK-NESTED-2: COMPLETION: t : [#int#]t |
40 } | 44 } |
41 | 45 |
42 // Handle templates | 46 // Handle templates |
43 template <typename T> | 47 template <typename T> |
47 int x; | 51 int x; |
48 char y; | 52 char y; |
49 }; | 53 }; |
50 void bar() { | 54 void bar() { |
51 Test<char> T{.x = 2}; | 55 Test<char> T{.x = 2}; |
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 | 56 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s |
53 // CHECK-CC3: COMPLETION: x : [#T#]x | 57 // CHECK-CC3: COMPLETION: x : [#T#]x |
54 Test<int> X{.x = 2}; | 58 Test<int> X{.x = 2}; |
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 | 59 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s |
56 // CHECK-CC4: COMPLETION: x : [#int#]x | 60 // CHECK-CC4: COMPLETION: x : [#int#]x |
57 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y | 61 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y |
58 } | 62 } |
59 | 63 |
60 template <typename T> | 64 template <typename T> |
61 void aux() { | 65 void aux() { |
62 Test<T> X{.x = T(2)}; | 66 Test<T> X{.x = T(2)}; |
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 | 67 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s |
64 } | 68 } |
65 | 69 |
66 namespace signature_regression { | 70 namespace signature_regression { |
67 // Verify that an old bug is gone: passing an init-list as a constructor arg | 71 // Verify that an old bug is gone: passing an init-list as a constructor arg |
68 // would emit overloads as a side-effect. | 72 // would emit overloads as a side-effect. |
69 struct S{int x;}; | 73 struct S{int x;}; |
70 int wrongFunction(S); | 74 int wrongFunction(S); |
71 int rightFunction(); | 75 int rightFunction(); |
72 int dummy = wrongFunction({1}); | 76 int dummy = wrongFunction({1}); |
73 int x = rightFunction(); | 77 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 | 78 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):25 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-SIGNATURE-REGRESSION %s |
75 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction | 79 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction |
76 // CHECK-SIGNATURE-REGRESSION: OVERLOAD: [#int#]rightFunction | 80 // CHECK-SIGNATURE-REGRESSION: OVERLOAD: [#int#]rightFunction |
77 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction | 81 // CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction |
78 } | 82 } |
79 | 83 |
80 struct WithAnon { | 84 struct WithAnon { |
81 int outer; | 85 int outer; |
82 struct { int inner; }; | 86 struct { int inner; }; |
83 }; | 87 }; |
84 auto TestWithAnon = WithAnon { .inner = 2 }; | 88 auto TestWithAnon = WithAnon { .inner = 2 }; |
85 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:84:33 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC5 %s | 89 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):33 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC5 %s |
86 // CHECK-CC5: COMPLETION: inner : [#int#]inner | 90 // CHECK-CC5: COMPLETION: inner : [#int#]inner |
87 // CHECK-CC5: COMPLETION: outer : [#int#]outer | 91 // CHECK-CC5: COMPLETION: outer : [#int#]outer |