// RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced -analyzer-output=text -verify %s
// RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced -analyzer-output=plist -o %t.plist %s
// RUN: FileCheck --input-file=%t.plist %s
#include "Inputs/system-header-simulator-for-nullability.h"
void takesNonnull(NSObject *_Nonnull y);
@interface ClassWithProperties: NSObject
@property(copy, nullable) NSObject *x; // plist check ensures no control flow piece from here to 'self.x'.
-(void) method;
@end;
@implementation ClassWithProperties
-(void) method {
// no-crash
NSObject *x = self.x; // expected-note{{Nullability 'nullable' is inferred}}
takesNonnull(x); // expected-warning{{Nullable pointer is passed to a callee that requires a non-null 1st parameter}}
// expected-note@-1{{Nullable pointer is passed to a callee that requires a non-null 1st parameter}}
}
@end
// CHECK: diagnostics
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: path
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
// CHECK-NEXT: edges
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: start
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col10
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: end
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindevent
// CHECK-NEXT: location
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT: ranges
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: depth1
// CHECK-NEXT: extended_message
// CHECK-NEXT: Nullability 'nullable' is inferred
// CHECK-NEXT: message
// CHECK-NEXT: Nullability 'nullable' is inferred
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
// CHECK-NEXT: edges
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: start
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col22
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: end
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col10
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
// CHECK-NEXT: edges
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: start
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line16
// CHECK-NEXT: col10
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: end
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col14
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindevent
// CHECK-NEXT: location
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT: ranges
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col16
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col16
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
// CHECK-NEXT: Nullable pointer is passed to a callee that requires a non-null 1st parameter
// CHECK-NEXT: message
// CHECK-NEXT: Nullable pointer is passed to a callee that requires a non-null 1st parameter
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: descriptionNullable pointer is passed to a callee that requires a non-null 1st parameter
// CHECK-NEXT: categoryMemory error
// CHECK-NEXT: typeNullability
// CHECK-NEXT: check_namenullability.NullPassedToNonnull
// CHECK-NEXT:
// CHECK-NEXT: issue_hash_content_of_line_in_contextb6bc8126de8e6eb3375483a656fe858d
// CHECK-NEXT: issue_context_kindObjective-C method
// CHECK-NEXT: issue_contextmethod
// CHECK-NEXT: issue_hash_function_offset3
// CHECK-NEXT: location
// CHECK-NEXT:
// CHECK-NEXT: line17
// CHECK-NEXT: col3
// CHECK-NEXT: file0
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: