Home | History | Annotate | Download | only in utils
      1 
      2 [Visualizer]
      3 
      4 llvm::SmallVector<*,*>{
      5 	preview (
      6 		#if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
      7 		#else (
      8 			#(
      9 				"[",
     10 				($T1*)$e.EndX - ($T1*)$e.BeginX,
     11 				"](",
     12 				#array(
     13 					expr: (($T1*)$e.BeginX)[$i],
     14 					size: ($T1*)$e.EndX - ($T1*)$e.BeginX
     15 				),
     16 				")"
     17 			)
     18 		)
     19 	)
     20 
     21 	children (
     22 		#(
     23 			#([size] : ($T1*)$e.EndX - ($T1*)$e.BeginX),
     24 			#([capacity] : ($T1*)$e.CapacityX - ($T1*)$e.BeginX),
     25 			#array(
     26 				expr: (($T1*)$e.BeginX)[$i],
     27 				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
     28 			)
     29 		)
     30 	)
     31 }
     32 
     33 llvm::SmallVectorImpl<*>{
     34 	preview (
     35 		#if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
     36 		#else (
     37 			#(
     38 				"[",
     39 				($T1*)$e.EndX - ($T1*)$e.BeginX,
     40 				"](",
     41 				#array(
     42 					expr: (($T1*)$e.BeginX)[$i],
     43 					size: ($T1*)$e.EndX - ($T1*)$e.BeginX
     44 				),
     45 				")"
     46 			)
     47 		)
     48 	)
     49 
     50 	children (
     51 		#(
     52 			#([size] : ($T1*)$e.EndX - ($T1*)$e.BeginX),
     53 			#([capacity] : ($T1*)$e.CapacityX - ($T1*)$e.BeginX),
     54 			#array(
     55 				expr: (($T1*)$e.BeginX)[$i],
     56 				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
     57 			)
     58 		)
     59 	)
     60 }
     61 
     62 llvm::SmallString<*>{
     63 	preview ([$e.BeginX,s])
     64 	stringview ([$e.BeginX,sb])
     65 }
     66 
     67 llvm::StringRef{
     68 	preview ([$e.Data,s])
     69 	stringview ([$e.Data,sb])
     70 
     71 	children (
     72 		#(
     73 			#([size] : $e.Length),
     74 			#array(expr: $e.Data[$i], size: $e.Length)
     75 		)
     76 	)
     77 }
     78 
     79 clang::Token{
     80 	preview((clang::tok::TokenKind)(int)$e.Kind)
     81 }
     82 
     83 llvm::PointerIntPair<*,*,*,*>{
     84 	preview (
     85 		#(
     86 			($T1*)($e.Value & $e.PointerBitMask),
     87 			" [",
     88 			($T3)(($e.Value >> $e.IntShift) & $e.IntMask),
     89 			"]"
     90 		)
     91 	)
     92 	
     93 	children (
     94 		#(
     95 			#([raw members] : [$e,!]),
     96 			#([ptr] : ($T1*)($e.Value & $e.PointerBitMask)),
     97 			#([int] : ($T3)($e.Value >> $e.IntShift) & $e.IntMask)
     98 		)
     99 	)
    100 }
    101 
    102 llvm::PointerUnion<*,*>{
    103 	preview (
    104 		#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) ( "PT1" )
    105 		#else ( "PT2" )
    106 	)
    107 	
    108 	children (
    109 		#(
    110 			#([raw members] : [$e,!]),
    111 			#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) (
    112 				#([ptr] : ($T1)($e.Val.Value & $e.Val.PointerBitMask))
    113 			) #else (
    114 				#([ptr] : ($T2)($e.Val.Value & $e.Val.PointerBitMask))
    115 			)
    116 		)
    117 	)
    118 }
    119 
    120 llvm::PointerUnion3<*,*,*>{
    121 	preview (
    122 		#if (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
    123 		#elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
    124 		#else ( "PT1" )
    125 	)
    126 	
    127 	children (
    128 		#(
    129 			#if (($e.Val.Val.Value & 0x2) == 2) (
    130 				#([ptr] : ($T2)(($e.Val.Val.Value >> 2) << 2))
    131 			) #elif (($e.Val.Val.Value & 0x1) == 1) (
    132 				#([ptr] : ($T3)(($e.Val.Val.Value >> 2) << 2))
    133 			) #else (
    134 				#([ptr] : ($T1)(($e.Val.Val.Value >> 2) << 2))
    135 			)
    136 		)
    137 	)
    138 }
    139 
    140 llvm::PointerUnion4<*,*,*,*>{
    141 	preview (
    142 		#if (($e.Val.Val.Value & 0x3) == 3) ( "PT4" )
    143 		#elif (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
    144 		#elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
    145 		#else ( "PT1" )
    146 	)
    147 	
    148 	children (
    149 		#(
    150 			#if (($e.Val.Val.Value & 0x3) == 3) (
    151 				#([ptr] : ($T4)(($e.Val.Val.Value >> 2) << 2))
    152 			) #elif (($e.Val.Val.Value & 0x2) == 2) (
    153 				#([ptr] : ($T2)(($e.Val.Val.Value >> 2) << 2))
    154 			) #elif (($e.Val.Val.Value & 0x1) == 1) (
    155 				#([ptr] : ($T3)(($e.Val.Val.Value >> 2) << 2))
    156 			) #else (
    157 				#([ptr] : ($T1)(($e.Val.Val.Value >> 2) << 2))
    158 			)
    159 		)
    160 	)
    161 }
    162 
    163 llvm::IntrusiveRefCntPtr<*>{
    164 	preview (
    165 		#if ($e.Obj == 0) ( "empty" )
    166 		#else (
    167 			#(
    168 				"[RefCnt=", $e.Obj->ref_cnt,
    169 				", ",
    170 				"Obj=", $e.Obj,
    171 				"]"
    172 			)
    173 		)
    174 	)
    175 
    176 	children (
    177 		#if ($e.Obj == 0) ( #array(expr: 0, size: 0) )
    178 		#else (
    179 			#(
    180 				#(RefCnt : $e.Obj->ref_cnt),
    181 				#(Obj : $e.Obj)
    182 			)
    183 		)
    184 	)
    185 }
    186 
    187 llvm::OwningPtr<*>{
    188 	preview (
    189 		#if ($e.Ptr == 0) ( "empty" )
    190 		#else ( $e.Ptr )
    191 	)
    192 
    193 	children (
    194 		#if ($e.Ptr == 0) ( #array(expr: 0, size: 0) )
    195 		#else ( #(Ptr : $e.Ptr) )
    196 	)	
    197 }
    198 
    199 llvm::SmallPtrSet<*,*>{
    200 	preview (
    201 		#(
    202 			#if (($e.CurArray) == ($e.SmallArray)) ( "[Small Mode] " )
    203 			#else ( "[Big Mode] " ),
    204 			"NumElements=", $e.NumElements,
    205 			" CurArraySize=", $e.CurArraySize
    206 		)
    207 	)
    208 
    209 	children (
    210 		#(
    211 			#([raw members] : [$c,!]),
    212 			#(NumElements : $e.NumElements),
    213 			#(CurArraySize : $e.CurArraySize),
    214 			#array(
    215 				expr: $e.CurArray[$i],
    216 				size: $e.CurArraySize + 1
    217 			) : ($T1*)&$e
    218 		)
    219 	)
    220 }
    221 
    222 llvm::DenseMap<*,*,*>{
    223 	preview (
    224 		#if ($e.NumEntries == 0) ( "empty" )
    225 		#else (
    226 			#(
    227 				"[NumEntries=", $e.NumEntries,
    228 				" NumBuckets=", $e.NumBuckets,
    229 				"]"
    230 			)
    231 		)
    232 	)
    233 
    234 	children (
    235 		#if ($e.NumEntries == 0) ( #array(expr: 0, size: 0) )
    236 		#else (
    237 			#(
    238 				#([raw members] : [$c,!]),
    239 				#(NumEntries : $e.NumEntries),
    240 				#(NumBuckets : $e.NumBuckets),
    241 				#array(
    242 					expr: $e.Buckets[$i],
    243 					size: $e.NumBuckets
    244 				)
    245 			)
    246 		)
    247 	)
    248 }
    249 
    250 llvm::StringMap<*,*>{
    251 	preview (
    252 		#(
    253 			"[NumBuckets=", $e.NumBuckets,
    254 			" ItemSize=", $e.ItemSize,
    255 			"]"
    256 		)
    257 	)
    258 
    259 	children (
    260 		#(
    261 			#([raw members] : [$c,!]),
    262 			#(NumBuckets : $e.NumBuckets),
    263 			#(ItemSize : $e.ItemSize),
    264 			#array(
    265 				expr: $e.TheTable[$i],
    266 				size: $e.NumBuckets,
    267 			) : (llvm::StringMapEntry<$T1>*)&$e
    268 		)
    269 	)
    270 }
    271 
    272 llvm::StringMapEntry<*>{
    273 	preview (
    274 		#if ($e.StrLen == 0) ( "empty" )
    275 		#else (	#(Entry : $e.second) )
    276 	)
    277 
    278 	children (
    279 		#if ($e.StrLen == 0) ( "empty" )
    280 		#else ( #(Entry : $e.second) )	
    281 	)
    282 }
    283 
    284 clang::DirectoryEntry|clang::FileEntry|clang::PragmaHandler{
    285 	preview ( [$e.Name,s] )
    286 	children (
    287 		#(
    288 			#([raw members] : [$c,!]),
    289 			#(Name : [$e.Name,s])
    290 		)
    291 	)
    292 }
    293 
    294 clang::DeclarationName{
    295 	preview (
    296 		; enum values from clang::DeclarationName::StoredNameKind
    297 		#if ($e.Ptr == 0) (
    298 			"empty"
    299 		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
    300 			#else ( #("Identifier, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask)) )
    301 		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
    302 			#("ZeroArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
    303 		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
    304 			#("OneArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
    305 		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
    306 			#switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
    307 			#case 0 ( ;DeclarationNameExtra::CXXConstructor
    308 				#("CXXConstructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    309 			)
    310 			#case 1 ( ;DeclarationNameExtra::CXXDestructor
    311 				#("CXXDestructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    312 			)
    313 			#case 2 ( ;DeclarationNameExtra::CXXConversionFunction
    314 				#("CXXConversionFunctionName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    315 			)
    316 			#case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
    317 				#("CXXLiteralOperatorName, ", (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
    318 			)
    319 			#case 47 ( ;DeclarationNameExtra::CXXUsingDirective
    320 				#("CXXUsingDirective")	;TODO What to add here?
    321 			)
    322 			#default (
    323 				#if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
    324 					#("CXXOperatorName, ", (clang::CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
    325 				) #else (
    326 					#("ObjCMultiArgSelector, ", (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
    327 				)
    328 			)
    329 		)
    330 	)
    331 
    332 	children (
    333 		#(
    334 			; enum values from clang::DeclarationName::StoredNameKind
    335 			#if ($e.Ptr == 0) (
    336 				#array( expr: 0, size: 0 )
    337 			) #else (
    338 				#(
    339 					#([raw members] : [$e.Ptr,!]),
    340 					if (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
    341 						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
    342 					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
    343 						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
    344 					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
    345 						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
    346 					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
    347 						#switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
    348 						#case 0 ( ;DeclarationNameExtra::CXXConstructor
    349 							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    350 						)
    351 						#case 1 ( ;DeclarationNameExtra::CXXDestructor
    352 							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    353 						)
    354 						#case 2 ( ;DeclarationNameExtra::CXXConversionFunction
    355 							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
    356 						)
    357 						#case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
    358 							#(Ptr : (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
    359 						)
    360 						#case 47 ( ;DeclarationNameExtra::CXXUsingDirective
    361 							#(Ptr : $e.Ptr)	;TODO What to add here?
    362 						)
    363 						#default (
    364 							#if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
    365 								#(Ptr : (CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
    366 							) #else (
    367 								#(Ptr : (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
    368 							)
    369 						)
    370 					)
    371 				)
    372 			)
    373 		)
    374 	)
    375 }
    376 
    377 clang::DeclSpec{
    378 	preview (
    379 		#(
    380 			"[",
    381 			(clang::DeclSpec::SCS)$e.StorageClassSpec,
    382 			", ",
    383 			(clang::TypeSpecifierType)$e.TypeSpecType,
    384 			"]"
    385 		)
    386 	)
    387 }
    388 
    389 llvm::Triple{
    390 	preview ( $e.Data )
    391 }
    392