[PATCH] D51281: [libclang] Return the proper pointee type for 'auto' deduced to pointer

Ivan Donchevskii via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 26 23:42:55 PDT 2018


yvvan created this revision.
yvvan added reviewers: erikjv, arphaman, michaelwu.

Currently the resulting type is always invalid in such case.


https://reviews.llvm.org/D51281

Files:
  tools/libclang/CXType.cpp


Index: tools/libclang/CXType.cpp
===================================================================
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -427,6 +427,7 @@
   if (!TP)
     return MakeCXType(QualType(), GetTU(CT));
 
+try_again:
   switch (TP->getTypeClass()) {
     case Type::Pointer:
       T = cast<PointerType>(TP)->getPointeeType();
@@ -444,6 +445,11 @@
     case Type::MemberPointer:
       T = cast<MemberPointerType>(TP)->getPointeeType();
       break;
+    case Type::Auto:
+      TP = cast<DeducedType>(TP)->getDeducedType().getTypePtrOrNull();
+      if (TP)
+        goto try_again;
+      break;
     default:
       T = QualType();
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51281.162617.patch
Type: text/x-patch
Size: 687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180827/a549da02/attachment.bin>


More information about the cfe-commits mailing list