File: cxx11-ast-print.cpp

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (62 lines) | stat: -rw-r--r-- 1,881 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// RUN: %clang_cc1 -std=c++11 -ast-print %s | FileCheck %s

// CHECK: auto operator""_foo(const char *p, decltype(sizeof(int))) -> decltype(nullptr);
auto operator"" _foo(const char *p, decltype(sizeof(int))) -> decltype(nullptr);

// CHECK: decltype(""_foo) operator""_bar(unsigned long long);
decltype(""_foo) operator"" _bar(unsigned long long);

// CHECK: decltype(42_bar) operator""_baz(long double);
decltype(42_bar) operator"" _baz(long double);

// CHECK: decltype(4.5_baz) operator""_baz(char);
decltype(4.5_baz) operator"" _baz(char);

// CHECK: const char *operator""_quux(const char *);
const char *operator"" _quux(const char *);

// CHECK: template <char ...> const char *operator""_fritz();
template<char...> const char *operator"" _fritz();

// CHECK: const char *p1 = "bar1"_foo;
const char *p1 = "bar1"_foo;
// CHECK: const char *p2 = "bar2"_foo;
const char *p2 = R"x(bar2)x"_foo;
// CHECK: const char *p3 = u8"bar3"_foo;
const char *p3 = u8"bar3"_foo;
// CHECK: const char *p4 = 297_bar;
const char *p4 = 0x129_bar;
// CHECK: const char *p5 = 1.0E+12_baz;
const char *p5 = 1e12_baz;
// CHECK: const char *p6 = 'x'_baz;
const char *p6 = 'x'_baz;
// CHECK: const char *p7 = 123_quux;
const char *p7 = 123_quux;
// CHECK: const char *p8 = 4.9_quux;
const char *p8 = 4.9_quux;
// CHECK: const char *p9 = 0x42e3F_fritz;
const char *p9 = 0x42e3F_fritz;
// CHECK: const char *p10 = 3.300e+15_fritz;
const char *p10 = 3.300e+15_fritz;

template <class C, C...> const char *operator"" _suffix();
// CHECK: const char *PR23120 = operator""_suffix<char32_t, U'\U00010437'>();
const char *PR23120 = U"𐐷"_suffix;

// PR28885
struct A {
  A();
};
struct B : A {
  using A::A; // CHECK:      using A::A;
};            // CHECK-NEXT: };

// CHECK: ;
;
// CHECK-NOT: ;

void g(int n) {
  int buffer[n];     // CHECK: int buffer[n];
  [&buffer]() {}();  // CHECK: [&buffer]
}