[PATCH] D12807: Display name of identifier tokens in Visual Studio native visualizer

Mike Spertus via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 10:13:38 PDT 2015


mspertus created this revision.
mspertus added a subscriber: cfe-commits.

The Token visualizer in clang.natvis makes debugging Clang in Visual Studio much easier for keywords (because a given keyword is always the same), but it doesn't work very well for identifiers (because they are all different). This change has the visualizer display the name of the identifier. I have been using this daily, and I find this simple change has lead to a much-improved day-to-day experience.

http://reviews.llvm.org/D12807

Files:
  utils/clang.natvis

Index: utils/clang.natvis
===================================================================
--- utils/clang.natvis
+++ utils/clang.natvis
@@ -27,7 +27,8 @@
     </Expand>
   </Type>
   <Type Name="clang::Token">
-    <DisplayString>{(clang::tok::TokenKind)Kind}</DisplayString>
+    <DisplayString Condition="Kind != clang::tok::identifier">{(clang::tok::TokenKind)Kind}</DisplayString>
+    <DisplayString Condition="Kind == clang::tok::identifier">{{Identifier ({*(clang::IdentifierInfo *)(PtrData)})}}</DisplayString>
   </Type>
   <Type Name="clang::DeclSpec">
     <DisplayString>[{(clang::DeclSpec::SCS)StorageClassSpec}], [{(clang::TypeSpecifierType)TypeSpecType}]</DisplayString>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12807.34557.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150911/b48a48f2/attachment.bin>


More information about the cfe-commits mailing list