At least on MSVC 2022, using $T1 does not work.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/utils/LLVMVisualizers/llvm.natvis | ||
---|---|---|
203 | We have other users of $T1* - such as for llvm::Optional<>- do they still work? |
I've just tried this and current trunk seems to work fine with VS2022 - please do you have a specific repro?
I hit this problem when working on clang-format.
In particular AnnotatingParser has SmallVector<Context, 8> Contexts; that did not work.
I'm using MSVC 2022 (14.31.31103, 17.1.0 preview 3.0, but that problem is there for a few weeks at least).
Using $T1 I get:
Using value_type, I get:
and
Maybe I should file a bug to MSVC?
BTW, the visualizer for llvm::Optional doesn't look good either.
It should be something like this:
<Type Name="llvm::Optional<*>"> <DisplayString Condition="!Storage.hasVal">None</DisplayString> <DisplayString Condition="Storage.hasVal">{Storage.value}</DisplayString> <Expand> <Item Name="[underlying]" Condition="Storage.hasVal">Storage.value</Item> </Expand> </Type>
so use Storage.value instead of *(($T1 *)(unsigned char *)Storage.storage.buffer).
It was changed back in February 2019 in commit https://github.com/llvm/llvm-project/commit/fb9730575086b3c2ba38a1aabf3106b01339888b.
Should I create a patch for Opional visualizer?
Strangely enough, using $T1 and $T1 * in other contexts than AnnotatingParser::Contexts works ok.
Ah - that might be it - I was checking it with SmallVector<int> - non-POD might still break it.
A llvm::Optional<> fix would be appreciated - cheers.
Do you see any warning spam when you enable Natvis diagnostics in VisualStudio?
https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects
Oh, natvis diagnostics enabled shows an error:
Natvis: E:\src\llvm-project\llvm\utils\LLVMVisualizers\llvm.natvis(30,23): Error: identifier "clang::format::`anonymous namespace'" is undefined Error while evaluating '(clang::format::`anonymous namespace'::AnnotatingParser::Context*)BeginX' in the context of type 'FormatTests.exe!llvm::SmallVectorImpl<clang::format::`anonymous namespace'::AnnotatingParser::Context>'.
so the anonymous namespace is making things fail.
To my understanding, it's probably because $T1 works like a macro, so a textual replacement...
We have other users of $T1* - such as for llvm::Optional<>- do they still work?