r271944 - Improved Visual Studio visualizations for template argument lists

Mike Spertus via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 14:41:20 PDT 2016


Author: mps
Date: Mon Jun  6 16:41:20 2016
New Revision: 271944

URL: http://llvm.org/viewvc/llvm-project?rev=271944&view=rev
Log:
Improved Visual Studio visualizations for template argument lists

Improved the visualizer for TemplateArgumentList to show type arguments in the DisplayString.
E.g., <double, long>. Added a visualizer for MultiLevelTemplateArgumentList.
I decided to display them by how they would appear in a template with the
(non-existent) template-id's omitted, so the DisplayString naturally presents
as something like <double, long>::<char *>.

Modified:
    cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=271944&r1=271943&r2=271944&view=diff
==============================================================================
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Mon Jun  6 16:41:20 2016
@@ -265,7 +265,7 @@ For later versions of Visual Studio, no
     <DisplayString IncludeView="arg1" Condition="NumArguments==1"></DisplayString>
     <DisplayString IncludeView="arg1">, {Arguments[1],view(cpp)}{*this,view(arg2)}</DisplayString>
     <DisplayString IncludeView="arg2" Condition="NumArguments==2"></DisplayString>
-    <DisplayString IncludeView="arg2">, {Arguments[2],view(cpp)}, ...</DisplayString>
+    <DisplayString IncludeView="arg2">, {Arguments[1],view(cpp)}, ...</DisplayString>
     <DisplayString><{*this,view(arg0)}></DisplayString>
     <Expand>
       <Item Name="NumArguments">NumArguments</Item>
@@ -275,6 +275,27 @@ For later versions of Visual Studio, no
       </ArrayItems>
     </Expand>
   </Type>
+  <Type Name="llvm::ArrayRef<clang::TemplateArgument>">
+    <DisplayString IncludeView="arg0" Condition="Length==0"></DisplayString>
+    <DisplayString IncludeView="arg0">{Data[0],view(cpp)}{*this,view(arg1)}</DisplayString>
+    <DisplayString IncludeView="arg1" Condition="Length==1"></DisplayString>
+    <DisplayString IncludeView="arg1">, {Data[1],view(cpp)}{*this,view(arg2)}</DisplayString>
+    <DisplayString IncludeView="arg2" Condition="Length==2"></DisplayString>
+    <DisplayString IncludeView="arg2">, {Data[2],view(cpp)}, ...</DisplayString>
+    <DisplayString><{*this,view(arg0)}></DisplayString>
+  </Type>
+  <Type Name="clang::MultiLevelTemplateArgumentList">
+    <DisplayString IncludeView="level0" Condition="(llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.EndX - (llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX==0"></DisplayString>
+    <DisplayString IncludeView="level0">{((llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX)[0],view(cpp)}{*this,view(level1)}</DisplayString>
+    <DisplayString IncludeView="level1" Condition="(llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.EndX - (llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX==1"></DisplayString>
+    <DisplayString IncludeView="level1">::{((llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX)[1],view(cpp)}{*this,view(level2)}</DisplayString>
+    <DisplayString IncludeView="level2" Condition="(llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.EndX - (llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX==2"></DisplayString>
+    <DisplayString IncludeView="level2">::{((llvm::ArrayRef<clang::TemplateArgument> *)TemplateArgumentLists.BeginX)[2],view(cpp)}, ...</DisplayString>
+    <DisplayString>{*this,view(level0)}</DisplayString>
+    <Expand>
+      <Item Name="TemplateList">TemplateArgumentLists</Item>
+    </Expand>
+  </Type>
   <!-- Builtin types that have C++ keywords are manually displayed as that keyword. Otherwise, just use the enum name -->
   <Type Name="clang::BuiltinType">
     <DisplayString Condition="BuiltinTypeBits.Kind==clang::BuiltinType::Void">void</DisplayString>




More information about the cfe-commits mailing list