summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorMichael Wu <mwu.code@gmail.com>2018-08-03 04:38:04 +0000
committerMichael Wu <mwu.code@gmail.com>2018-08-03 04:38:04 +0000
commit7649e6290667d96ac3070c42fdc840e631fdc17f (patch)
tree09a47ed44e7bc9ef7b1cd123da8d1d86a90b2eef /clang/test
parent153085d6bc7c15e059a32f8223479a8e35d82ee5 (diff)
downloadbcm5719-llvm-7649e6290667d96ac3070c42fdc840e631fdc17f.tar.gz
bcm5719-llvm-7649e6290667d96ac3070c42fdc840e631fdc17f.zip
[libclang 4/8] Add the clang_Type_getNullability() API
Summary: This patch adds a clang-c API for querying the nullability of an AttributedType. The test here also tests D49081 Reviewers: yvvan, jbcoe Reviewed By: yvvan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49082 llvm-svn: 338809
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Index/nullability.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Index/nullability.c b/clang/test/Index/nullability.c
new file mode 100644
index 00000000000..26e55cb65f4
--- /dev/null
+++ b/clang/test/Index/nullability.c
@@ -0,0 +1,10 @@
+int *a;
+int * _Nonnull b;
+int * _Nullable c;
+int * _Null_unspecified d;
+
+// RUN: env CINDEXTEST_INCLUDE_ATTRIBUTED_TYPES=1 c-index-test -test-print-type %s | FileCheck %s
+// CHECK: VarDecl=a:1:6 [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int]
+// CHECK: VarDecl=b:2:16 [type=int * _Nonnull] [typekind=Attributed] [nullability=nonnull] [canonicaltype=int *] [canonicaltypekind=Pointer] [modifiedtype=int *] [modifiedtypekind=Pointer] [isPOD=1]
+// CHECK: VarDecl=c:3:17 [type=int * _Nullable] [typekind=Attributed] [nullability=nullable] [canonicaltype=int *] [canonicaltypekind=Pointer] [modifiedtype=int *] [modifiedtypekind=Pointer] [isPOD=1]
+// CHECK: VarDecl=d:4:25 [type=int * _Null_unspecified] [typekind=Attributed] [nullability=unspecified] [canonicaltype=int *] [canonicaltypekind=Pointer] [modifiedtype=int *] [modifiedtypekind=Pointer] [isPOD=1]
OpenPOWER on IntegriCloud