Permalink
Browse files

Updating the visualizers to include more datatypes. Patch thanks to J…

…ay Blanchard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157763 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
1 parent 694a942 commit 46eb6ca7f22369982d05b316faa51acb3b1229e9 @AaronBallman AaronBallman committed May 31, 2012
Showing with 267 additions and 41 deletions.
  1. +267 −41 utils/clangVisualizers.txt
View
308 utils/clangVisualizers.txt
@@ -3,15 +3,18 @@
llvm::SmallVector<*,*>{
preview (
- #(
- "[",
- ($T1*)$e.EndX - ($T1*)$e.BeginX,
- "](",
- #array(
- expr: (($T1*)$e.BeginX)[$i],
- size: ($T1*)$e.EndX - ($T1*)$e.BeginX
- ),
- ")"
+ #if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
+ #else (
+ #(
+ "[",
+ ($T1*)$e.EndX - ($T1*)$e.BeginX,
+ "](",
+ #array(
+ expr: (($T1*)$e.BeginX)[$i],
+ size: ($T1*)$e.EndX - ($T1*)$e.BeginX
+ ),
+ ")"
+ )
)
)
@@ -29,15 +32,18 @@ llvm::SmallVector<*,*>{
llvm::SmallVectorImpl<*>{
preview (
- #(
- "[",
- ($T1*)$e.EndX - ($T1*)$e.BeginX,
- "](",
- #array(
- expr: (($T1*)$e.BeginX)[$i],
- size: ($T1*)$e.EndX - ($T1*)$e.BeginX
- ),
- ")"
+ #if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
+ #else (
+ #(
+ "[",
+ ($T1*)$e.EndX - ($T1*)$e.BeginX,
+ "](",
+ #array(
+ expr: (($T1*)$e.BeginX)[$i],
+ size: ($T1*)$e.EndX - ($T1*)$e.BeginX
+ ),
+ ")"
+ )
)
)
@@ -86,6 +92,7 @@ llvm::PointerIntPair<*,*,*,*>{
children (
#(
+ #([raw members] : [$e,!]),
#([ptr] : ($T1*)($e.Value & $e.PointerBitMask)),
#([int] : ($T3)($e.Value >> $e.IntShift) & $e.IntMask)
)
@@ -94,18 +101,16 @@ llvm::PointerIntPair<*,*,*,*>{
llvm::PointerUnion<*,*>{
preview (
- #if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) (
- "PT1"
- ) #else (
- "PT2"
- )
+ #if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) ( "PT1" )
+ #else ( "PT2" )
)
children (
#(
+ #([raw members] : [$e,!]),
#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) (
#([ptr] : ($T1)($e.Val.Value & $e.Val.PointerBitMask))
- ) #else (
+ ) #else (
#([ptr] : ($T2)($e.Val.Value & $e.Val.PointerBitMask))
)
)
@@ -114,13 +119,9 @@ llvm::PointerUnion<*,*>{
llvm::PointerUnion3<*,*,*>{
preview (
- #if (($e.Val.Val.Value & 0x2) == 2) (
- "PT2"
- ) #elif (($e.Val.Val.Value & 0x1) == 1) (
- "PT3"
- ) #else (
- "PT1"
- )
+ #if (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
+ #elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
+ #else ( "PT1" )
)
children (
@@ -138,22 +139,17 @@ llvm::PointerUnion3<*,*,*>{
llvm::PointerUnion4<*,*,*,*>{
preview (
- #if (($e.Val.Val.Value & 0x3) == 3) (
- "PT4"
- ) #elif (($e.Val.Val.Value & 0x2) == 2) (
- "PT2"
- ) #elif (($e.Val.Val.Value & 0x1) == 1) (
- "PT3"
- ) #else (
- "PT1"
- )
+ #if (($e.Val.Val.Value & 0x3) == 3) ( "PT4" )
+ #elif (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
+ #elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
+ #else ( "PT1" )
)
children (
#(
#if (($e.Val.Val.Value & 0x3) == 3) (
#([ptr] : ($T4)(($e.Val.Val.Value >> 2) << 2))
- ) #elif (($e.Val.Val.Value & 0x2) == 2) (
+ ) #elif (($e.Val.Val.Value & 0x2) == 2) (
#([ptr] : ($T2)(($e.Val.Val.Value >> 2) << 2))
) #elif (($e.Val.Val.Value & 0x1) == 1) (
#([ptr] : ($T3)(($e.Val.Val.Value >> 2) << 2))
@@ -163,3 +159,233 @@ llvm::PointerUnion4<*,*,*,*>{
)
)
}
+
+llvm::IntrusiveRefCntPtr<*>{
+ preview (
+ #if ($e.Obj == 0) ( "empty" )
+ #else (
+ #(
+ "[RefCnt=", $e.Obj->ref_cnt,
+ ", ",
+ "Obj=", $e.Obj,
+ "]"
+ )
+ )
+ )
+
+ children (
+ #if ($e.Obj == 0) ( #array(expr: 0, size: 0) )
+ #else (
+ #(
+ #(RefCnt : $e.Obj->ref_cnt),
+ #(Obj : $e.Obj)
+ )
+ )
+ )
+}
+
+llvm::OwningPtr<*>{
+ preview (
+ #if ($e.Ptr == 0) ( "empty" )
+ #else ( $e.Ptr )
+ )
+
+ children (
+ #if ($e.Ptr == 0) ( #array(expr: 0, size: 0) )
+ #else ( #(Ptr : $e.Ptr) )
+ )
+}
+
+llvm::SmallPtrSet<*,*>{
+ preview (
+ #(
+ #if (($e.CurArray) == ($e.SmallArray)) ( "[Small Mode] " )
+ #else ( "[Big Mode] " ),
+ "NumElements=", $e.NumElements,
+ " CurArraySize=", $e.CurArraySize
+ )
+ )
+
+ children (
+ #(
+ #([raw members] : [$c,!]),
+ #(NumElements : $e.NumElements),
+ #(CurArraySize : $e.CurArraySize),
+ #array(
+ expr: $e.CurArray[$i],
+ size: $e.CurArraySize + 1
+ ) : ($T1*)&$e
+ )
+ )
+}
+
+llvm::DenseMap<*,*,*>{
+ preview (
+ #if ($e.NumEntries == 0) ( "empty" )
+ #else (
+ #(
+ "[NumEntries=", $e.NumEntries,
+ " NumBuckets=", $e.NumBuckets,
+ "]"
+ )
+ )
+ )
+
+ children (
+ #if ($e.NumEntries == 0) ( #array(expr: 0, size: 0) )
+ #else (
+ #(
+ #([raw members] : [$c,!]),
+ #(NumEntries : $e.NumEntries),
+ #(NumBuckets : $e.NumBuckets),
+ #array(
+ expr: $e.Buckets[$i],
+ size: $e.NumBuckets
+ )
+ )
+ )
+ )
+}
+
+llvm::StringMap<*,*>{
+ preview (
+ #(
+ "[NumBuckets=", $e.NumBuckets,
+ " ItemSize=", $e.ItemSize,
+ "]"
+ )
+ )
+
+ children (
+ #(
+ #([raw members] : [$c,!]),
+ #(NumBuckets : $e.NumBuckets),
+ #(ItemSize : $e.ItemSize),
+ #array(
+ expr: $e.TheTable[$i],
+ size: $e.NumBuckets,
+ ) : (llvm::StringMapEntry<$T1>*)&$e
+ )
+ )
+}
+
+llvm::StringMapEntry<*>{
+ preview (
+ #if ($e.StrLen == 0) ( "empty" )
+ #else ( #(Entry : $e.second) )
+ )
+
+ children (
+ #if ($e.StrLen == 0) ( "empty" )
+ #else ( #(Entry : $e.second) )
+ )
+}
+
+clang::DirectoryEntry|clang::FileEntry|clang::PragmaHandler{
+ preview ( [$e.Name,s] )
+ children (
+ #(
+ #([raw members] : [$c,!]),
+ #(Name : [$e.Name,s])
+ )
+ )
+}
+
+clang::DeclarationName{
+ preview (
+ ; enum values from clang::DeclarationName::StoredNameKind
+ #if ($e.Ptr == 0) (
+ "empty"
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
+ #else ( #("Identifier, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask)) )
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
+ #("ZeroArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
+ #("OneArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
+ #switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
+ #case 0 ( ;DeclarationNameExtra::CXXConstructor
+ #("CXXConstructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 1 ( ;DeclarationNameExtra::CXXDestructor
+ #("CXXDestructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 2 ( ;DeclarationNameExtra::CXXConversionFunction
+ #("CXXConversionFunctionName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
+ #("CXXLiteralOperatorName, ", (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 47 ( ;DeclarationNameExtra::CXXUsingDirective
+ #("CXXUsingDirective") ;TODO What to add here?
+ )
+ #default (
+ #if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
+ #("CXXOperatorName, ", (clang::CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+ ) #else (
+ #("ObjCMultiArgSelector, ", (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
+ )
+ )
+ )
+ )
+
+ children (
+ #(
+ ; enum values from clang::DeclarationName::StoredNameKind
+ #if ($e.Ptr == 0) (
+ #array( expr: 0, size: 0 )
+ ) #else (
+ #(
+ #([raw members] : [$e.Ptr,!]),
+ if (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
+ #(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
+ #(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
+ #(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+ ) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
+ #switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
+ #case 0 ( ;DeclarationNameExtra::CXXConstructor
+ #(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 1 ( ;DeclarationNameExtra::CXXDestructor
+ #(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 2 ( ;DeclarationNameExtra::CXXConversionFunction
+ #(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
+ #(Ptr : (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+ )
+ #case 47 ( ;DeclarationNameExtra::CXXUsingDirective
+ #(Ptr : $e.Ptr) ;TODO What to add here?
+ )
+ #default (
+ #if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
+ #(Ptr : (CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+ ) #else (
+ #(Ptr : (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+}
+
+clang::DeclSpec{
+ preview (
+ #(
+ "[",
+ (clang::DeclSpec::SCS)$e.StorageClassSpec,
+ ", ",
+ (clang::TypeSpecifierType)$e.TypeSpecType,
+ "]"
+ )
+ )
+}
+
+llvm::Triple{
+ preview ( $e.Data )
+}

0 comments on commit 46eb6ca

Please sign in to comment.