summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-08-27 08:41:06 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-09-07 13:20:23 +0000
commit5d08e4bd09e184ec138fad141ca1fb2bca9e5091 (patch)
tree3665a7079565b8502f57e52697bcee906fa5dc8e /tools
parentec72f6df5d332a0499ff448d587e0b4afb60ecc8 (diff)
[backported/clang-8][libclang] Return the proper pointee type for 'auto' deduced to pointer
-------------------------------------------------------------------------- * https://reviews.llvm.org/D51281 -------------------------------------------------------------------------- Currently the resulting type is always invalid in such case. Change-Id: Ic0c9be8c44905d286af38980e4dd65c51f64f0d9 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CXType.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp
index dfc0152477..127c0376fd 100644
--- a/tools/libclang/CXType.cpp
+++ b/tools/libclang/CXType.cpp
@@ -427,6 +427,7 @@ CXType clang_getPointeeType(CXType CT) {
if (!TP)
return MakeCXType(QualType(), GetTU(CT));
+try_again:
switch (TP->getTypeClass()) {
case Type::Pointer:
T = cast<PointerType>(TP)->getPointeeType();
@@ -444,6 +445,12 @@ CXType clang_getPointeeType(CXType CT) {
case Type::MemberPointer:
T = cast<MemberPointerType>(TP)->getPointeeType();
break;
+ case Type::Auto:
+ case Type::DeducedTemplateSpecialization:
+ TP = cast<DeducedType>(TP)->getDeducedType().getTypePtrOrNull();
+ if (TP)
+ goto try_again;
+ break;
default:
T = QualType();
break;