From 4bc75f046018bcc81ede90d548f95da8ed14f1a9 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 11 May 2023 09:27:58 -0400 Subject: [PATCH] Fixed NATVIS debug visualizers for Clang This fixes the visualizers for: Type DeclContext QualType TypedefNameDecl NestedNameSpecifier FunctionDecl and adds visualizers for: VariableArrayType ElaboratedType ParenType BitIntType --- clang/utils/ClangVisualizers/clang.natvis | 138 ++++++++++++++-------- 1 file changed, 88 insertions(+), 50 deletions(-) diff --git a/clang/utils/ClangVisualizers/clang.natvis b/clang/utils/ClangVisualizers/clang.natvis index 3e6148cd5e05..ff949ce490d1 100644 --- a/clang/utils/ClangVisualizers/clang.natvis +++ b/clang/utils/ClangVisualizers/clang.natvis @@ -25,11 +25,16 @@ For later versions of Visual Studio, no setup is required--> {*(clang::BuiltinType *)this} {*(clang::PointerType *)this} + {*(clang::ParenType *)this} + {(clang::BitIntType *)this} {*(clang::LValueReferenceType *)this} {*(clang::RValueReferenceType *)this} {(clang::ConstantArrayType *)this,na} {(clang::ConstantArrayType *)this,view(left)na} {(clang::ConstantArrayType *)this,view(right)na} + {(clang::VariableArrayType *)this,na} + {(clang::VariableArrayType *)this,view(left)na} + {(clang::VariableArrayType *)this,view(right)na} {(clang::IncompleteArrayType *)this,na} {(clang::IncompleteArrayType *)this,view(left)na} {(clang::IncompleteArrayType *)this,view(right)na} @@ -39,6 +44,9 @@ For later versions of Visual Studio, no setup is required--> {(clang::DecayedType *)this,na} {(clang::DecayedType *)this,view(left)na} {(clang::DecayedType *)this,view(right)na} + {(clang::ElaboratedType *)this,na} + {(clang::ElaboratedType *)this,view(left)na} + {(clang::ElaboratedType *)this,view(right)na} {*(clang::TemplateTypeParmType *)this} {*(clang::TemplateTypeParmType *)this,view(cpp)} {*(clang::SubstTemplateTypeParmType *)this} @@ -59,25 +67,17 @@ For later versions of Visual Studio, no setup is required--> {*this,view(cpp)} No visualizer yet for {(clang::Type::TypeClass)TypeBits.TC,en}Type - Dependent{" ",sb} - - InstantiationDependent{" ",sb} - - VariablyModified{" ",sb} - - ContainsUnexpandedParameterPack{" ",sb} - + Dependence{" ",en} + CachedLinkage: {(clang::Linkage)TypeBits.CachedLinkage,en} CachedLocalOrUnnamed CachedLinkage: {(clang::Linkage)TypeBits.CachedLinkage,en}{" ",sb} FromAST - + No TypeBits set beyond TypeClass - -{*this, view(Dependent)}{*this, view(InstantiationDependent)}{*this, view(VariablyModified)} -{*this, view(ContainsUnexpandedParameterPack)}{*this, view(Cache)}{*this, view(FromAST)} + {*this, view(Dependence)}{*this, view(Cache)}{*this, view(FromAST)} {*this,view(cmn)} {{{*this,view(poly)}}} (clang::Type::TypeClass)TypeBits.TC @@ -85,12 +85,16 @@ For later versions of Visual Studio, no setup is required--> CanonicalType *(clang::BuiltinType *)this *(clang::PointerType *)this + *(clang::ParenType*)this + *(clang::BitIntType*)this *(clang::LValueReferenceType *)this *(clang::RValueReferenceType *)this (clang::ConstantArrayType *)this + (clang::VariableArrayType *)this (clang::IncompleteArrayType *)this *(clang::AttributedType *)this (clang::DecayedType *)this + (clang::ElaboratedType *)this (clang::TemplateTypeParmType *)this (clang::SubstTemplateTypeParmType *)this (clang::RecordType *)this @@ -125,6 +129,15 @@ For later versions of Visual Studio, no setup is required--> (clang::ArrayType *)this + + {ElementType,view(cpp)} + [*] + {ElementType,view(cpp)}[*] + + (clang::Expr *)SizeExpr + (clang::ArrayType *)this + + {Decl,view(name)nd} {Decl} @@ -140,6 +153,21 @@ For later versions of Visual Studio, no setup is required--> *(clang::Type *)this, view(cmn) + + {Inner, view(cpp)} + + Inner + *(clang::Type *)this, view(cmn) + + + + signed _BitInt({NumBits}) + unsigned _BitInt({NumBits})( + + NumBits + (clang::Type *)this, view(cmn) + + @@ -171,7 +199,7 @@ For later versions of Visual Studio, no setup is required--> FirstDecl - (clang::Decl *)(NextInContextAndBits.Value & ~3) + (clang::Decl *)(*(intptr_t *)NextInContextAndBits.Value.Data & ~3) *this @@ -213,15 +241,15 @@ For later versions of Visual Studio, no setup is required--> - {(clang::TypeSourceInfo *)(MaybeModedTInfo.Value & ~7LL),view(cpp)na} - {(clang::TypedefNameDecl::ModedTInfo *)(MaybeModedTInfo.Value & ~7LL),view(cpp)na} + {(clang::TypeSourceInfo *)(*(uintptr_t *)MaybeModedTInfo.Value.Data & ~7LL),view(cpp)na} + {(clang::TypedefNameDecl::ModedTInfo *)(*(uintptr_t *)MaybeModedTInfo.Value.Data & ~7LL),view(cpp)na} {(TypeDecl *)this,view(cpp)nand} typedef {this,view(type)na} {this,view(name)na}; - "Not yet calculated",sb - (bool)(MaybeModedTInfo.Value & 2) - (clang::TypeSourceInfo *)(MaybeModedTInfo.Value & ~7LL) - (clang::TypedefNameDecl::ModedTInfo *)(MaybeModedTInfo.Value & ~7LL) + "Not yet calculated",sb + (bool)(*(uintptr_t *)MaybeModedTInfo.Value.Data & 2) + (clang::TypeSourceInfo *)(*(uintptr_t *)MaybeModedTInfo.Value.Data & ~7LL) + (clang::TypedefNameDecl::ModedTInfo *)(*(uintptr_t *)MaybeModedTInfo.Value.Data & ~7LL) (TypeDecl *)this,nd @@ -400,6 +428,16 @@ For later versions of Visual Studio, no setup is required--> (clang::AdjustedType *)this + + {NamedType,view(left)} + {NamedType,view(right)} + {NamedType} + + (clang::ElaboratedTypeKeyword)TypeWithKeywordBits.Keyword + NNS + NamedType,view(cmn) + + {TTPDecl->Name,view(cpp)} Non-canonical: {*TTPDecl} @@ -426,11 +464,11 @@ For later versions of Visual Studio, no setup is required--> - {(IdentifierInfo*)Specifier,view(cpp)na}:: - {(NamedDecl*)Specifier,view(cpp)na}:: - {(Type*)Specifier,view(cpp)na}:: + {(IdentifierInfo*)Specifier,view(cpp)na}:: + {(NamedDecl*)Specifier,view(cpp)na}:: + {(Type*)Specifier,view(cpp)na}:: - (NestedNameSpecifier::StoredSpecifierKind)((Prefix.Value>>1)&3) + (NestedNameSpecifier::StoredSpecifierKind)((*(uintptr_t *)Prefix.Value.Data>>1)&3) @@ -442,28 +480,28 @@ For later versions of Visual Studio, no setup is required--> - - {*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(poly)}{*this,view(fastQuals)} - {*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(cpp)}{*this,view(fastQuals)} - {*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(left)}{*this,view(fastQuals)} - {*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(right)}{*this,view(fastQuals)} + {((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType,view(poly)}{*this,view(fastQuals)} + {((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType,view(cpp)}{*this,view(fastQuals)} + {((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType,view(left)}{*this,view(fastQuals)} + {((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType,view(right)}{*this,view(fastQuals)} - - {" ",sb}const - {" ",sb}restrict - {" ",sb}const restrict - {" ",sb}volatile - {" ",sb}const volatile - {" ",sb}volatile restrict - {" ",sb}const volatile restrict + + {" ",sb}const + {" ",sb}restrict + {" ",sb}const restrict + {" ",sb}volatile + {" ",sb}const volatile + {" ",sb}volatile restrict + {" ",sb}const volatile restrict Cannot visualize non-fast qualifiers - Null - {((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,na}{*this,view(fastQuals)} + Null + {((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType,na}{*this,view(fastQuals)} *this,view(fastQuals) - ((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType + ((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)Value.Value.Data) & ~(uintptr_t)((1U << clang::TypeAlignmentInBits) - 1U)))->BaseType + {DeclInfo,view(cpp)na} @@ -889,31 +927,31 @@ For later versions of Visual Studio, no setup is required--> - {((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) & ~15))->BaseType)->ResultType,view(cpp)} - + {((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)DeclType.Value.Value.Data) & ~15))->BaseType)->ResultType,view(cpp)} + {ParamInfo[0],na}{*this,view(parm1)nd} - + , {ParamInfo[1],na}{*this,view(parm2)nd} - + , {ParamInfo[2],na}{*this,view(parm3)nd} - + , {ParamInfo[3],na}{*this,view(parm4)nd} - + , {ParamInfo[4],na}{*this,view(parm5)nd} - + , /* expand for more params */ - - auto {Name,view(cpp)nd}({*this,view(parm0)nd}) -> {((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) & ~15))->BaseType)->ResultType,view(cpp)} + + auto {Name,view(cpp)nd}({*this,view(parm0)nd}) -> {((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)DeclType.Value.Value.Data) & ~15))->BaseType)->ResultType,view(cpp)} {this,view(retType)nand} {Name,view(cpp)nd}({*this,view(parm0)nd}) (clang::DeclaratorDecl *)this,nd - ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) & ~15))->BaseType)->ResultType + ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)DeclType.Value.Value.Data) & ~15))->BaseType)->ResultType {*this,view(parm0)nd} - ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) & ~15))->BaseType)->FunctionTypeBits.NumParams + ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)((*(uintptr_t *)DeclType.Value.Value.Data) & ~15))->BaseType)->FunctionTypeBits.NumParams ParamInfo