File: designated-initializer.c

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (40 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download | duplicates (8)
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
// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG %s 2>&1 \
// RUN:   | FileCheck %s

struct Q { int a, b, c; };
union UQ { struct Q q; };
union UQ getUQ() {
  union UQ u = { { 1, 2, 3 } };
  return u;
}

void test() {
  struct LUQ { union UQ uq; } var = { getUQ(), .uq.q.a = 100 };
  struct Q s[] = {
    [0] = (struct Q){1, 2},
    [0].c = 3
  }; 
}

// CHECK: void test()
// CHECK: [B1]
// CHECK:   1: getUQ
// CHECK:   2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)())
// CHECK:   3: [B1.2]()
// CHECK:   4: 100
// CHECK:   5: /*no init*/
// CHECK:   6: /*no init*/
// CHECK:   7: {[B1.4], [B1.5], [B1.6]}
// CHECK:   8: {[B1.7]}
// CHECK:   9: {/*base*/[B1.3], /*updater*/[B1.8]}
// CHECK:  10: {[B1.3], .uq.q.a = [B1.4]}
// CHECK:  11: struct LUQ var = {getUQ(), .uq.q.a = 100};
// CHECK:  12: 1
// CHECK:  13: 2
// CHECK:  14: {[B1.12], [B1.13]}
// CHECK:  17: /*no init*/
// CHECK:  18: /*no init*/
// CHECK:  19: 3
// CHECK:  20: {[B1.17], [B1.18], [B1.19]}
// CHECK:  21: {/*base*/[B1.16], /*updater*/[B1.20]} 
// CHECK:  23: struct Q s[] = {[0] = (struct Q){1, 2}, [0].c = 3};