[clang] 8569465 - Add a Clang NATVIS visualizer for StringLiteral

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 12 06:22:49 PST 2023


Author: Aaron Ballman
Date: 2023-11-12T09:22:15-05:00
New Revision: 8569465adf5e6c792e88be56b0e6b24f1c74e633

URL: https://github.com/llvm/llvm-project/commit/8569465adf5e6c792e88be56b0e6b24f1c74e633
DIFF: https://github.com/llvm/llvm-project/commit/8569465adf5e6c792e88be56b0e6b24f1c74e633.diff

LOG: Add a Clang NATVIS visualizer for StringLiteral

Added: 
    

Modified: 
    clang/utils/ClangVisualizers/clang.natvis

Removed: 
    


################################################################################
diff  --git a/clang/utils/ClangVisualizers/clang.natvis b/clang/utils/ClangVisualizers/clang.natvis
index 9faaa8a8bba8cf0..0c09d3480b07a9a 100644
--- a/clang/utils/ClangVisualizers/clang.natvis
+++ b/clang/utils/ClangVisualizers/clang.natvis
@@ -1000,8 +1000,15 @@ For later versions of Visual Studio, no setup is required-->
     </Expand>
   </Type>
   <Type Name="clang::Expr">
+    <DisplayString Condition="StmtBits.sClass==clang::Stmt::StmtClass::StringLiteralClass" IncludeView="poly">{*(clang::StringLiteral *)this}</DisplayString>
     <DisplayString>Expression of class {(clang::Stmt::StmtClass)StmtBits.sClass,en} and type {TR,view(cpp)}</DisplayString>
   </Type>
+  <Type Name="clang::StringLiteral">
+    <Expand>
+      <Item Name="Length">*(unsigned *)(((clang::StringLiteral *)this)+1)</Item>
+      <Item Name="Data" Condition="StringLiteralBits.NumConcatenated==1">(const char *)(((clang::StringLiteral *)this)+1)+4+4,[*(unsigned *)(((clang::StringLiteral *)this)+1)]s8</Item>
+    </Expand>
+  </Type>
   <Type Name="clang::DeclAccessPair">
     <DisplayString IncludeView="access" Condition="(Ptr&Mask) == clang::AS_public">public</DisplayString>
     <DisplayString IncludeView="access" Condition="(Ptr&Mask) == clang::AS_protected">protected</DisplayString>


        


More information about the cfe-commits mailing list