summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/Core/index-source.m
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-11-09 02:47:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-11-09 02:47:07 +0000
commitf95a000421cc56a8693cd1a63fc5b2defb351279 (patch)
tree84e41a8b4adde87c1ea5abe31f054f446687bbb4 /clang/test/Index/Core/index-source.m
parent0f1ddfa8465291349a380469549b9d8eeea994e2 (diff)
downloadbcm5719-llvm-f95a000421cc56a8693cd1a63fc5b2defb351279.tar.gz
bcm5719-llvm-f95a000421cc56a8693cd1a63fc5b2defb351279.zip
[index] Fix issue with protocol name locations in conformance list of an ObjC class when they come from a typedef.
The ObjC class protocol list assumes there is an associated location for each protocol but no location is provided when the protocol list comes from a typedef, and we end up with a buffer overflow when trying to get locations for the protocol names. Fixes crash of rdar://28980278. llvm-svn: 286331
Diffstat (limited to 'clang/test/Index/Core/index-source.m')
-rw-r--r--clang/test/Index/Core/index-source.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Index/Core/index-source.m b/clang/test/Index/Core/index-source.m
index 554378ea3cf..fc1b6232cfe 100644
--- a/clang/test/Index/Core/index-source.m
+++ b/clang/test/Index/Core/index-source.m
@@ -129,3 +129,23 @@ extern int setjmp(jmp_buf);
// CHECK: [[@LINE+1]]:12 | extension/ObjC | <no-name> | <no-usr> | <no-cgname> | Decl | rel: 0
@interface NonExistent()
@end
+
+@interface MyGenCls<ObjectType> : Base
+@end
+
+@protocol MyEnumerating
+@end
+
+// CHECK: [[@LINE+4]]:41 | type-alias/C | MyEnumerator | c:index-source.m@T@MyEnumerator | <no-cgname> | Def | rel: 0
+// CHECK: [[@LINE+3]]:26 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref | rel: 0
+// CHECK: [[@LINE+2]]:9 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref | rel: 0
+// CHECK: [[@LINE+1]]:18 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref | rel: 0
+typedef MyGenCls<Base *><MyEnumerating> MyEnumerator;
+
+// CHECK: [[@LINE+5]]:12 | class/ObjC | PermanentEnumerator | c:objc(cs)PermanentEnumerator | _OBJC_CLASS_$_PermanentEnumerator | Decl | rel: 0
+// CHECK: [[@LINE+4]]:34 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,RelBase | rel: 1
+// CHECK-NEXT: RelBase | PermanentEnumerator | c:objc(cs)PermanentEnumerator
+// CHECK: [[@LINE+2]]:34 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,RelBase | rel: 1
+// CHECK-NEXT: RelBase | PermanentEnumerator | c:objc(cs)PermanentEnumerator
+@interface PermanentEnumerator : MyEnumerator
+@end
OpenPOWER on IntegriCloud