diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-04-28 09:46:36 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-04-28 09:46:36 +0000 |
commit | 45c423bcdc25712f123c3161090a776640b36021 (patch) | |
tree | 1755f99c08d203dee0e5e074cf8c5d4984cb37ba | |
parent | 6f975692e5c4f038a7325a58b5b47647844f8f38 (diff) | |
download | bcm5719-llvm-45c423bcdc25712f123c3161090a776640b36021.tar.gz bcm5719-llvm-45c423bcdc25712f123c3161090a776640b36021.zip |
[index] Handle vector types in USR generator
rdar://25339187
llvm-svn: 301635
-rw-r--r-- | clang/lib/Index/USRGeneration.cpp | 8 | ||||
-rw-r--r-- | clang/test/Index/usrs.cpp | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index ed469f677a3..044edf715fc 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -811,7 +811,13 @@ void USRGenerator::VisitType(QualType T) { T = InjT->getInjectedSpecializationType(); continue; } - + if (const auto *VT = T->getAs<VectorType>()) { + Out << (T->isExtVectorType() ? ']' : '['); + Out << VT->getNumElements(); + T = VT->getElementType(); + continue; + } + // Unhandled type. Out << ' '; break; diff --git a/clang/test/Index/usrs.cpp b/clang/test/Index/usrs.cpp index 8ad17021b50..2bd5744371a 100644 --- a/clang/test/Index/usrs.cpp +++ b/clang/test/Index/usrs.cpp @@ -95,6 +95,14 @@ class TC1 { void meth(TC1); }; +typedef __attribute__((__ext_vector_type__(3))) float float3; + +typedef float __m128 __attribute__((__vector_size__(16))); + +float3 vectorOverload(float3 f); + +__m128 vectorOverload(__m128 f); + // RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck %s // CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2] // CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8] @@ -172,3 +180,6 @@ class TC1 { // CHECK: usrs.cpp c:usrs.cpp@S@usrs.cpp@1510@FI@x Extent=[91:10 - 91:15] // CHECK: usrs.cpp c:@ST>1#T@TC1@F@meth#>@ST>1#T@TC11t0.0# Extent=[95:3 - 95:17] + +// CHECK: usrs.cpp c:@F@vectorOverload#]3f# Extent=[102:1 - 102:32] +// CHECK: usrs.cpp c:@F@vectorOverload#[4f# Extent=[104:1 - 104:32] |