File: attr-print-emit.cpp

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (69 lines) | stat: -rw-r--r-- 3,435 bytes parent folder | download | duplicates (19)
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
63
64
65
66
67
68
69
// RUN: %clang_cc1 %s -ast-print | FileCheck %s
// RUN: %clang -emit-ast -o %t.ast %s
// RUN: %clang_cc1 %t.ast -ast-print | FileCheck %s

// CHECK: void xla(int a) __attribute__((xray_log_args(1)));
void xla(int a) __attribute__((xray_log_args(1)));

// CHECK: void *as2(int, int) __attribute__((alloc_size(1, 2)));
void *as2(int, int) __attribute__((alloc_size(1, 2)));
// CHECK: void *as1(void *, int) __attribute__((alloc_size(2)));
void *as1(void *, int) __attribute__((alloc_size(2)));

// CHECK: void fmt(int, const char *, ...) __attribute__((format(printf, 2, 3)));
void fmt(int, const char *, ...) __attribute__((format(printf, 2, 3)));

// CHECK: char *fmta(int, const char *) __attribute__((format_arg(2)));
char *fmta(int, const char *) __attribute__((format_arg(2)));

// CHECK: void nn(int *, int *) __attribute__((nonnull(1, 2)));
void nn(int *, int *) __attribute__((nonnull(1, 2)));

// CHECK: int *aa(int i) __attribute__((alloc_align(1)));
int *aa(int i) __attribute__((alloc_align(1)));

// CHECK: void ownt(int *, int *) __attribute__((ownership_takes(foo, 1, 2)));
void ownt(int *, int *) __attribute__((ownership_takes(foo, 1, 2)));
// CHECK: void ownh(int *, int *) __attribute__((ownership_holds(foo, 1, 2)));
void ownh(int *, int *) __attribute__((ownership_holds(foo, 1, 2)));
// CHECK: void ownr(int) __attribute__((ownership_returns(foo, 1)));
void ownr(int) __attribute__((ownership_returns(foo, 1)));

// CHECK: void awtt(int, int, ...) __attribute__((argument_with_type_tag(foo, 3, 2)));
void awtt(int, int, ...) __attribute__((argument_with_type_tag(foo, 3, 2)));
// CHECK: void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 1, 2)));
void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 1, 2)));

class C {
  // CHECK: void xla(int a) __attribute__((xray_log_args(2)));
  void xla(int a) __attribute__((xray_log_args(2)));

  // CHECK: void *as2(int, int) __attribute__((alloc_size(2, 3)));
  void *as2(int, int) __attribute__((alloc_size(2, 3)));
  // CHECK: void *as1(void *, int) __attribute__((alloc_size(3)));
  void *as1(void *, int) __attribute__((alloc_size(3)));

  // CHECK: void fmt(int, const char *, ...) __attribute__((format(printf, 3, 4)));
  void fmt(int, const char *, ...) __attribute__((format(printf, 3, 4)));

  // CHECK: char *fmta(int, const char *) __attribute__((format_arg(3)));
  char *fmta(int, const char *) __attribute__((format_arg(3)));

  // CHECK: void nn(int *, int *) __attribute__((nonnull(2, 3)));
  void nn(int *, int *) __attribute__((nonnull(2, 3)));

  // CHECK: int *aa(int i) __attribute__((alloc_align(2)));
  int *aa(int i) __attribute__((alloc_align(2)));

  // CHECK: void ownt(int *, int *) __attribute__((ownership_takes(foo, 2, 3)));
  void ownt(int *, int *) __attribute__((ownership_takes(foo, 2, 3)));
  // CHECK: void ownh(int *, int *) __attribute__((ownership_holds(foo, 2, 3)));
  void ownh(int *, int *) __attribute__((ownership_holds(foo, 2, 3)));
  // CHECK: void ownr(int) __attribute__((ownership_returns(foo, 2)));
  void ownr(int) __attribute__((ownership_returns(foo, 2)));

  // CHECK: void awtt(int, int, ...) __attribute__((argument_with_type_tag(foo, 4, 3)));
  void awtt(int, int, ...) __attribute__((argument_with_type_tag(foo, 4, 3)));
  // CHECK: void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 2, 3)));
  void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 2, 3)));
};