// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
// Nullability of const string-like globals, testing
// NonnullGlobalConstantsChecker.
void ;
@class NSString;
typedef const struct __CFString *CFStringRef;
typedef const struct __CFBoolean *CFBooleanRef;
typedef const struct CF_BRIDGED_TYPE __CFNull *CFNullRef;
extern const CFNullRef kCFNull;
// Global NSString* is non-null.
extern NSString *const StringConstGlobal;
void
// The logic does not apply to local variables though.
extern NSString *;
void
// Global const CFStringRef's are also assumed to be non-null.
extern const CFStringRef CFStringConstGlobal;
void
// But only "const" ones.
extern CFStringRef CFStringNonConstGlobal;
void
// char* const is also assumed to be non-null.
extern const char *const ConstCharStarConst;
void
// Pointer value can be mutable.
extern char *const CharStarConst;
void
// But the pointer itself should be immutable.
extern char *CharStar;
void
// Type definitions should also work across typedefs, for pointers:
typedef char *const str;
extern str globalStr;
void
// And for types.
typedef NSString *const NStr;
extern NStr globalNSString;
void NSStringCheckTypedef
// Note that constness could be either inside
// the var declaration, or in a typedef.
typedef NSString *NStr2;
extern const NStr2 globalNSString2;
void NSStringCheckConstTypedef
// Nested typedefs should work as well.
typedef const CFStringRef str1;
typedef str1 str2;
extern str2 globalStr2;
void
// And for NSString *.
typedef NSString *const nstr1;
typedef nstr1 nstr2;
extern nstr2 nglobalStr2;
void
// And for CFBooleanRefs.
extern const CFBooleanRef kBool;
void
// And again, only for const one.
extern CFBooleanRef kBoolMutable;
void
// If it's annotated as nonnull, it doesn't even need to be const.
extern CFStringRef _Nonnull str3;
void
// This one's nonnull for two reasons.
extern const CFStringRef _Nonnull str4;
void
void