[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeCompletion / attr.cpp
blobcff0fa7224b6c4394d7077c0b8a3b6ca122396eb
1 int a [[gnu::used]];
2 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):9 %s | FileCheck --check-prefix=STD %s
3 // STD: COMPLETION: Pattern : __carries_dependency__
4 // STD-NOT: COMPLETION: Pattern : __convergent__
5 // STD: COMPLETION: Pattern : __gnu__::__used__
6 // STD-NOT: COMPLETION: Pattern : __gnu__::used
7 // STD-NOT: COMPLETION: Pattern : __used__
8 // STD: COMPLETION: Pattern : _Clang::__convergent__
9 // STD: COMPLETION: Pattern : carries_dependency
10 // STD-NOT: COMPLETION: Pattern : clang::called_once
11 // STD: COMPLETION: Pattern : clang::convergent
12 // STD-NOT: COMPLETION: Pattern : convergent
13 // STD-NOT: COMPLETION: Pattern : gnu::__used__
14 // STD: COMPLETION: Pattern : gnu::abi_tag(<#Tags...#>)
15 // STD: COMPLETION: Pattern : gnu::alias(<#Aliasee#>)
16 // STD: COMPLETION: Pattern : gnu::used
17 // STD-NOT: COMPLETION: Pattern : used
18 // RUN: %clang_cc1 -code-completion-at=%s:%(line-17):9 -xobjective-c++ %s | FileCheck --check-prefix=STD-OBJC %s
19 // STD-OBJC: COMPLETION: Pattern : clang::called_once
20 // RUN: %clang_cc1 -code-completion-at=%s:%(line-19):14 %s | FileCheck --check-prefix=STD-NS %s
21 // STD-NS-NOT: COMPLETION: Pattern : __used__
22 // STD-NS-NOT: COMPLETION: Pattern : carries_dependency
23 // STD-NS-NOT: COMPLETION: Pattern : clang::convergent
24 // STD-NS-NOT: COMPLETION: Pattern : convergent
25 // STD-NS-NOT: COMPLETION: Pattern : gnu::used
26 // STD-NS: COMPLETION: Pattern : used
27 int b [[__gnu__::used]];
28 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):18 %s | FileCheck --check-prefix=STD-NSU %s
29 // STD-NSU: COMPLETION: Pattern : __used__
30 // STD-NSU-NOT: COMPLETION: Pattern : used
32 int c [[using gnu: used]];
33 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):15 %s | FileCheck --check-prefix=STD-USING %s
34 // STD-USING: COMPLETION: __gnu__
35 // STD-USING: COMPLETION: _Clang
36 // STD-USING-NOT: COMPLETION: Pattern : carries_dependency
37 // STD-USING: COMPLETION: clang
38 // STD-USING-NOT: COMPLETION: Pattern : clang::
39 // STD-USING-NOT: COMPLETION: Pattern : gnu::
40 // STD-USING: COMPLETION: gnu
41 // RUN: %clang_cc1 -code-completion-at=%s:%(line-9):20 %s | FileCheck --check-prefix=STD-NS %s
43 int d __attribute__((used));
44 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):22 %s | FileCheck --check-prefix=GNU %s
45 // GNU: COMPLETION: Pattern : __carries_dependency__
46 // GNU: COMPLETION: Pattern : __convergent__
47 // GNU-NOT: COMPLETION: Pattern : __gnu__::__used__
48 // GNU: COMPLETION: Pattern : __used__
49 // GNU-NOT: COMPLETION: Pattern : _Clang::__convergent__
50 // GNU: COMPLETION: Pattern : carries_dependency
51 // GNU-NOT: COMPLETION: Pattern : clang::convergent
52 // GNU: COMPLETION: Pattern : convergent
53 // GNU-NOT: COMPLETION: Pattern : gnu::used
54 // GNU: COMPLETION: Pattern : used
56 #pragma clang attribute push (__attribute__((internal_linkage)), apply_to=variable)
57 int e;
58 #pragma clang attribute pop
59 // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):46 %s | FileCheck --check-prefix=PRAGMA %s
60 // PRAGMA: COMPLETION: Pattern : internal_linkage
62 #ifdef MS_EXT
63 int __declspec(thread) f;
64 // RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:%(line-1):16 %s | FileCheck --check-prefix=DS %s
65 // DS-NOT: COMPLETION: Pattern : __convergent__
66 // DS-NOT: COMPLETION: Pattern : __used__
67 // DS-NOT: COMPLETION: Pattern : clang::convergent
68 // DS-NOT: COMPLETION: Pattern : convergent
69 // DS: COMPLETION: Pattern : thread
70 // DS-NOT: COMPLETION: Pattern : used
71 // DS: COMPLETION: Pattern : uuid
73 [uuid("123e4567-e89b-12d3-a456-426614174000")] struct g;
74 // RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:%(line-1):2 %s | FileCheck --check-prefix=MS %s
75 // MS-NOT: COMPLETION: Pattern : __uuid__
76 // MS-NOT: COMPLETION: Pattern : clang::convergent
77 // MS-NOT: COMPLETION: Pattern : convergent
78 // MS-NOT: COMPLETION: Pattern : thread
79 // MS-NOT: COMPLETION: Pattern : used
80 // MS: COMPLETION: Pattern : uuid
81 #endif // MS_EXT
83 void foo() {
84 [[omp::sequence(directive(parallel), directive(critical))]]
87 // FIXME: support for omp attributes would be nice.
88 // RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-4):5 %s | FileCheck --check-prefix=OMP-NS --allow-empty %s
89 // OMP-NS-NOT: COMPLETION: omp
90 // RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-6):10 %s | FileCheck --check-prefix=OMP-ATTR --allow-empty %s
91 // OMP-ATTR-NOT: COMPLETION: Pattern : sequence
92 // RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-8):19 %s | FileCheck --check-prefix=OMP-NESTED --allow-empty %s
93 // OMP-NESTED-NOT: COMPLETION: Pattern : directive