1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
2// RUN:   -verify %s 2>&1 | FileCheck %s
3
4// expected-no-diagnostics
5
6void clang_analyzer_printState();
7
8@interface NSObject {
9}
10+ (id)alloc;
11+ (Class)class;
12- (id)init;
13- (Class)class;
14@end
15
16@interface Parent : NSObject
17@end
18@interface Child : Parent
19@end
20
21void foo(id A, id B);
22
23@implementation Child
24+ (void)test {
25  id ClassAsID = [self class];
26  id Object = [[ClassAsID alloc] init];
27  Class TheSameClass = [Object class];
28
29  clang_analyzer_printState();
30  // CHECK:      "class_object_types": [
31  // CHECK-NEXT:   { "symbol": "conj_$[[#]]{Class, LC[[#]], S[[#]], #[[#]]}", "dyn_type": "Child", "sub_classable": true },
32  // CHECK-NEXT:   { "symbol": "conj_$[[#]]{Class, LC[[#]], S[[#]], #[[#]]}", "dyn_type": "Child", "sub_classable": true }
33  // CHECK-NEXT: ]
34
35  // Let's make sure that the information is not GC'd away.
36  foo(ClassAsID, TheSameClass);
37}
38@end
39