From d9af48a93174591ed7a7318757bf57ccb1761943 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Wed, 21 Dec 2016 01:05:29 +0000 Subject: [PATCH] Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string The usual method, and the one employed before my change, of displaying strings in natvis is to make use of the ",s" format specifier; however, this method only works for null-terminated strings. My fix here is to use the ",[size]" format specifier to display a bounded array, and then cast it to "const char*", which in the MSVC debugger has the desired effect of rendering the character array as a string. Differential Revision: https://reviews.llvm.org/D27972 llvm-svn: 290224 --- llvm/utils/LLVMVisualizers/llvm.natvis | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/utils/LLVMVisualizers/llvm.natvis b/llvm/utils/LLVMVisualizers/llvm.natvis index 6d8475a..439868a 100644 --- a/llvm/utils/LLVMVisualizers/llvm.natvis +++ b/llvm/utils/LLVMVisualizers/llvm.natvis @@ -56,8 +56,8 @@ For later versions of Visual Studio, no setup is required. - {BeginX,s} - BeginX,s + {(const char*)BeginX,[(char*)EndX - (char*)BeginX] na} + (const char*)BeginX,[(char*)EndX - (char*)BeginX] (char*)EndX - (char*)BeginX (char*)CapacityX - (char*)BeginX -- 2.7.4