Skip to content

Commit 7063a83

Browse files
Machiel van HoorenAaronBallman
authored andcommitted
Add MSVC natvis visualisation of llvm::Type
llvm::Type has some difficult to decode member variables with different meanings depending on the TypeID. Specifically SubclassData and ContainedTys. This natvis visualisation decodes and visualises those members.
1 parent 8fa743a commit 7063a83

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

llvm/utils/LLVMVisualizers/llvm.natvis

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,51 @@ For later versions of Visual Studio, no setup is required.
253253
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
254254
</Expand>
255255
</Type>
256+
<!-- llvm::Type has two fields, SubclassData and ContainedTys, the meaning of which change depending on the TypeID.
257+
This visualiser decodes those fields based on the value of ID.
258+
-->
259+
<Type Name="llvm::Type">
260+
<DisplayString>{ID}</DisplayString>
261+
<Expand>
262+
<Item Name="ID">ID</Item>
263+
264+
<Item Name="NumBits" Condition="ID == llvm::Type::TypeID::IntegerTyID">SubclassData</Item>
265+
266+
<Item Name="ReturnType" Condition="ID == llvm::Type::TypeID::FunctionTyID">*ContainedTys</Item>
267+
<Synthetic Name="Arguments" Condition="ID == llvm::Type::TypeID::FunctionTyID">
268+
<DisplayString>{NumContainedTys - 1}</DisplayString>
269+
<Expand>
270+
<ArrayItems>
271+
<Size>NumContainedTys - 1</Size>
272+
<ValuePointer>ContainedTys + 1</ValuePointer>
273+
</ArrayItems>
274+
</Expand>
275+
</Synthetic>
276+
<Item Name="IsVarArg" Condition="ID == llvm::Type::TypeID::FunctionTyID">SubclassData == 1</Item>
277+
278+
<Item Name="HasBody" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_HasBody) != 0</Item>
279+
<Item Name="Packed" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_Packed) != 0</Item>
280+
<Item Name="IsLiteral" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_IsLiteral) != 0</Item>
281+
<Item Name="IsSized" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_IsSized) != 0</Item>
282+
<Synthetic Name="Members" Condition="ID == llvm::Type::TypeID::StructTyID">
283+
<DisplayString>{NumContainedTys}</DisplayString>
284+
<Expand>
285+
<ArrayItems>
286+
<Size>NumContainedTys</Size>
287+
<ValuePointer>ContainedTys</ValuePointer>
288+
</ArrayItems>
289+
</Expand>
290+
</Synthetic>
291+
292+
<Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ArrayTyID || ID == llvm::Type::TypeID::VectorTyID">*ContainedTys</Item>
293+
<Item Name="NumElements" Condition="ID == llvm::Type::TypeID::ArrayTyID">((llvm::ArrayType*)this)->NumElements</Item>
294+
295+
<Item Name="AddressSpace" Condition="ID == llvm::Type::TypeID::PointerTyID">SubclassData</Item>
296+
<Item Name="PointeeType" Condition="ID == llvm::Type::TypeID::PointerTyID">*ContainedTys</Item>
297+
298+
<Item Name="NumElements" Condition="ID == llvm::Type::TypeID::VectorTyID">((llvm::VectorType*)this)->NumElements</Item>
299+
300+
<Item Name="Context">Context</Item>
301+
</Expand>
302+
</Type>
256303
</AutoVisualizer>

0 commit comments

Comments
 (0)