[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [cfe-commits] [PATCH] VS Visualizers additions
From:       J B <jayblanchard.cpp () gmail ! com>
Date:       2012-05-31 18:52:39
Message-ID: CACuSP7_AedJduTiMRfMpNzhCtVH31p-T_D-LWt3qM4LyBNJ08g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Here's a patch adding more and improving some existing VS Visualizers.

I'm new to the code base so I was mostly just working my way through
objects in the debugger and improving what I encountered.  I have a pretty
decent grasp at this point of what the expression language can do, after
fighting with it for several hours.  If there are Types that more
experienced devs would like to see visualized, I'd be happy to take a stab
at them.

Thanks,

Jay Blanchard

[Attachment #5 (text/html)]

Here&#39;s a patch adding more and improving some existing VS \
Visualizers.<br><br>I&#39;m new to the code base so I was mostly just working my way  \
through objects in the debugger and improving what I encountered.  I  have a pretty \
decent grasp at this point of what the expression language  can do, after fighting \
with it for several hours.  If there are Types  that more experienced devs would like \
to see visualized, I&#39;d be happy to  take a stab at them.<br>
<br>Thanks,<br><br>Jay Blanchard

--20cf300fad196d437804c1599285--


["clangVisualizers.txt.patch" (application/octet-stream)]

Index: clangVisualizers.txt
===================================================================
--- clangVisualizers.txt	(revision 156990)
+++ clangVisualizers.txt	(working copy)
@@ -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::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 @@
 	
 	children (
 		#(
+			#([raw members] : [$e,!]),
 			#([ptr] : ($T1*)($e.Value & $e.PointerBitMask)),
 			#([int] : ($T3)($e.Value >> $e.IntShift) & $e.IntMask)
 		)
@@ -94,18 +101,16 @@
 
 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::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::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::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 )
+}


_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic