[cfe-dev] Clang C API with ObjC Nullability

Kristóf Liliom via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 24 03:18:36 PDT 2015


Hi,

I don't really know whether the following behaviour is intentional or not when using Objective-C's nullability. The output of the following code was created via "c-index-test -test-print-type"

@interface NotNullAnnotated
@property (assign) int *x1;
@end

This gives me an output which I expect:
ObjCPropertyDecl=x1:14:25 [assign,] [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int]

But when using nullability:
@interface NonNullAnnotated
@property (assign) int * _Nonnull x2;
@end

I get this:
ObjCPropertyDecl=x2:21:35 [assign,] [type=int * _Nonnull] [typekind=Unexposed] [canonicaltype=int *] [canonicaltypekind=Pointer] [isPOD=1]

While I would expect:
ObjCPropertyDecl=x2:21:35 [assign,] [type=int * _Nonnull] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int]

AFAIK nullability is a property on a type and should not modify its typekind. Is this behaviour intentional or a bug?

Yours Sincerely,
Kristof




More information about the cfe-dev mailing list