Skip to content

Commit 2c1ca93

Browse files
author
arphaman
committed
[index] Handle vector types in USR generator
rdar://25339187 git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@301635 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 05d209c commit 2c1ca93

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/Index/USRGeneration.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,13 @@ void USRGenerator::VisitType(QualType T) {
811811
T = InjT->getInjectedSpecializationType();
812812
continue;
813813
}
814-
814+
if (const auto *VT = T->getAs<VectorType>()) {
815+
Out << (T->isExtVectorType() ? ']' : '[');
816+
Out << VT->getNumElements();
817+
T = VT->getElementType();
818+
continue;
819+
}
820+
815821
// Unhandled type.
816822
Out << ' ';
817823
break;

test/Index/usrs.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ class TC1 {
9595
void meth(TC1);
9696
};
9797

98+
typedef __attribute__((__ext_vector_type__(3))) float float3;
99+
100+
typedef float __m128 __attribute__((__vector_size__(16)));
101+
102+
float3 vectorOverload(float3 f);
103+
104+
__m128 vectorOverload(__m128 f);
105+
98106
// RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck %s
99107
// CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2]
100108
// CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
@@ -172,3 +180,6 @@ class TC1 {
172180
// CHECK: usrs.cpp c:usrs.cpp@[email protected]@1510@FI@x Extent=[91:10 - 91:15]
173181

174182
// CHECK: usrs.cpp c:@ST>1#T@TC1@F@meth#>@ST>1#[email protected]# Extent=[95:3 - 95:17]
183+
184+
// CHECK: usrs.cpp c:@F@vectorOverload#]3f# Extent=[102:1 - 102:32]
185+
// CHECK: usrs.cpp c:@F@vectorOverload#[4f# Extent=[104:1 - 104:32]

0 commit comments

Comments
 (0)