[PATCH] Expose template types in libclang

Olivier JG olivier.jg at gmail.com
Sat May 31 05:53:16 PDT 2014


The various template types are currently given as CXType_Unexposed, where exposing them would be very useful for knowing when you can call functions that work on them, such as clang_Type_getNumTemplateArguments/clang_Type_getTemplateArgumentAsType.

http://reviews.llvm.org/D3978

Files:
  include/clang-c/Index.h
  tools/libclang/CXType.cpp

Index: include/clang-c/Index.h
===================================================================
--- include/clang-c/Index.h
+++ include/clang-c/Index.h
@@ -2747,7 +2747,12 @@
   CXType_IncompleteArray = 114,
   CXType_VariableArray = 115,
   CXType_DependentSizedArray = 116,
-  CXType_MemberPointer = 117
+  CXType_MemberPointer = 117,
+  CXType_TemplateTypeParm = 118,
+  CXType_SubstTemplateTypeParm = 119,
+  CXType_SubstTemplateTypeParmPack = 120,
+  CXType_TemplateSpecialization = 121,
+  CXType_DependentTemplateSpecialization = 122,
 };
 
 /**
Index: tools/libclang/CXType.cpp
===================================================================
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -90,6 +90,11 @@
     TKCASE(DependentSizedArray);
     TKCASE(Vector);
     TKCASE(MemberPointer);
+    TKCASE(TemplateTypeParm);
+    TKCASE(SubstTemplateTypeParm);
+    TKCASE(SubstTemplateTypeParmPack);
+    TKCASE(TemplateSpecialization);
+    TKCASE(DependentTemplateSpecialization);
     default:
       return CXType_Unexposed;
   }
@@ -483,6 +488,11 @@
     TKIND(DependentSizedArray);
     TKIND(Vector);
     TKIND(MemberPointer);
+    TKIND(TemplateTypeParm);
+    TKIND(SubstTemplateTypeParm);
+    TKIND(SubstTemplateTypeParmPack);
+    TKIND(TemplateSpecialization);
+    TKIND(DependentTemplateSpecialization);
   }
 #undef TKIND
   return cxstring::createRef(s);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3978.9982.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140531/b9fd6715/attachment.bin>


More information about the cfe-commits mailing list