58 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s 2>&1 | FileCheck %s2// expected-no-diagnostics3 4void clang_analyzer_printState();5 6struct Member {7 int large[10];8};9Member getMember();10 11struct Class {12 Member m;13 int first;14 int second;15 int third;16};17 18 19void test_output(int n) {20 Class objsecond;21 objsecond.m.large[n] = 20;22 23 Class objfirst;24 25 objfirst.m = getMember();26 objfirst.second = 2;27 objfirst.third = 3;28 objfirst.first = 1;29 30 clang_analyzer_printState();31 // Default binding is before any direct bindings.32 // Direct bindings are increasing by offset.33 // Global memory space clusters come before any other clusters.34 // Otherwise, Clusters are in alphabetical order.35 36 // CHECK: "store": { "pointer": "0x{{[0-9a-f]+}}", "items": [37 // CHECK-NEXT: { "cluster": "GlobalInternalSpaceRegion", "pointer": "0x{{[0-9a-f]+}}", "items": [38 // CHECK-NEXT: { "kind": "Default", "offset": 0, "value": "conj_$39 // CHECK-NEXT: ]},40 // CHECK-NEXT: { "cluster": "GlobalSystemSpaceRegion", "pointer": "0x{{[0-9a-f]+}}", "items": [41 // CHECK-NEXT: { "kind": "Default", "offset": 0, "value": "conj_$42 // CHECK-NEXT: ]},43 // CHECK-NEXT: { "cluster": "objfirst", "pointer": "0x{{[0-9a-f]+}}", "items": [44 // CHECK-NEXT: { "kind": "Default", "offset": 0, "value": "lazyCompoundVal45 // CHECK-NEXT: { "kind": "Direct", "offset": 320, "value": "1 S32b" },46 // CHECK-NEXT: { "kind": "Direct", "offset": 352, "value": "2 S32b" },47 // CHECK-NEXT: { "kind": "Direct", "offset": 384, "value": "3 S32b" }48 // CHECK-NEXT: ]},49 // CHECK-NEXT: { "cluster": "objsecond", "pointer": "0x{{[0-9a-f]+}}", "items": [50 // CHECK-NEXT: { "kind": "Default", "offset": 0, "value": "Unknown" },51 // CHECK-NEXT: { "kind": "Direct", "offset": null, "value": "20 S32b" }52 // CHECK-NEXT: ]}53 // CHECK-NEXT: ]},54 55 (void)objfirst;56 (void)objsecond;57}58