[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / attr-order.cpp
blob21e30e5b6f9df1a51da51c2fd7bdea1521b9ff9c
1 // RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-ignored-attributes -verify %s
3 struct [[]] __attribute__((lockable)) __declspec(dllexport) A {}; // ok
4 struct [[]] __declspec(dllexport) __attribute__((lockable)) B {}; // ok
5 struct [[]] [[]] __declspec(dllexport) __attribute__((lockable)) C {}; // ok
6 struct __declspec(dllexport) [[]] __attribute__((lockable)) D {}; // ok
7 struct __declspec(dllexport) __attribute__((lockable)) [[]] E {}; // ok
8 struct __attribute__((lockable)) __declspec(dllexport) [[]] F {}; // ok
9 struct __attribute__((lockable)) [[]] __declspec(dllexport) G {}; // ok
10 struct [[]] __attribute__((lockable)) [[]] __declspec(dllexport) H {}; // ok
12 [[noreturn]] __attribute__((cdecl)) __declspec(dllexport) void a(); // ok
13 [[noreturn]] __declspec(dllexport) __attribute__((cdecl)) void b(); // ok
14 [[]] [[noreturn]] __attribute__((cdecl)) __declspec(dllexport) void c(); // ok
16 __declspec(dllexport) [[noreturn]] __attribute__((cdecl)) void d(); // expected-error {{an attribute list cannot appear here}}
17 __declspec(dllexport) __attribute__((cdecl)) [[noreturn]] void e(); // expected-error {{an attribute list cannot appear here}}
18 __attribute__((cdecl)) __declspec(dllexport) [[noreturn]] void f(); // expected-error {{an attribute list cannot appear here}}
20 __attribute__((cdecl)) [[noreturn]] __declspec(dllexport) void g(); // ok
22 [[noreturn]] __attribute__((cdecl))
23 [[]]
24 __declspec(dllexport) void h();
26 template <int a>
27 __attribute__((cdecl)) [[noreturn]] __declspec(dllexport) void i(); // ok
29 template <int a>
30 [[]] [[noreturn]] __attribute__((cdecl)) __declspec(dllexport) void j(); // ok
32 template <int a>
33 [[noreturn]] __declspec(dllexport) __attribute__((cdecl)) void k(); // ok
35 extern "C" {
36 __attribute__ ((__warn_unused_result__)) [[__maybe_unused__]] int l(int); // ok
37 [[__maybe_unused__]] __attribute__ ((__warn_unused_result__)) int m(int); // ok
40 extern "C" {
41 __attribute__ ((__warn_unused_result__)) [[__maybe_unused__]] int n (int); // ok
42 __attribute__ ((__warn_unused_result__)) [[__maybe_unused__]] static int o (int x) { return x; }; // ok
45 extern "C" __attribute__ ((__warn_unused_result__)) [[__maybe_unused__]] int p(int); // ok
46 extern "C" [[__maybe_unused__]] __attribute__ ((__warn_unused_result__)) int q(int); // ok