@@ -386,6 +386,15 @@ struct RefactoringInfo {
386
386
387
387
RefactoringInfo (UIdent Kind, StringRef KindName, StringRef UnavailableReason)
388
388
: Kind(Kind), KindName(KindName), UnavailableReason(UnavailableReason) {}
389
+
390
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
391
+ OS << Indentation << " RefactoringInfo" << ' \n ' ;
392
+ OS << Indentation << " Kind: " << Kind.getName () << ' \n ' ;
393
+ OS << Indentation << " KindName: " << KindName << ' \n ' ;
394
+ OS << Indentation << " UnavailableReason: " << UnavailableReason << ' \n ' ;
395
+ }
396
+
397
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
389
398
};
390
399
391
400
struct ParentInfo {
@@ -395,6 +404,15 @@ struct ParentInfo {
395
404
396
405
ParentInfo (StringRef Title, StringRef KindName, StringRef USR)
397
406
: Title(Title), KindName(KindName), USR(USR) {}
407
+
408
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
409
+ OS << Indentation << " ParentInfo" << ' \n ' ;
410
+ OS << Indentation << " Title: " << Title << ' \n ' ;
411
+ OS << Indentation << " KindName: " << KindName << ' \n ' ;
412
+ OS << Indentation << " USR: " << USR << ' \n ' ;
413
+ }
414
+
415
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
398
416
};
399
417
400
418
struct ReferencedDeclInfo {
@@ -413,6 +431,24 @@ struct ReferencedDeclInfo {
413
431
: USR(USR), DeclarationLang(DeclLang), AccessLevel(AccessLevel),
414
432
FilePath (FilePath), ModuleName(ModuleName), IsSystem(System),
415
433
IsSPI(SPI), ParentContexts(Parents) {}
434
+
435
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
436
+ OS << Indentation << " ReferencedDeclInfo" << ' \n ' ;
437
+ OS << Indentation << " USR: " << USR << ' \n ' ;
438
+ OS << Indentation << " DeclarationLang: " << DeclarationLang.getName ()
439
+ << ' \n ' ;
440
+ OS << Indentation << " AccessLevel: " << AccessLevel << ' \n ' ;
441
+ OS << Indentation << " FilePath: " << FilePath << ' \n ' ;
442
+ OS << Indentation << " ModuleName: " << ModuleName << ' \n ' ;
443
+ OS << Indentation << " IsSystem: " << IsSystem << ' \n ' ;
444
+ OS << Indentation << " IsSPI: " << IsSPI << ' \n ' ;
445
+ OS << Indentation << " ParentContexts:" << ' \n ' ;
446
+ for (auto ParentCtx : ParentContexts) {
447
+ ParentCtx.print (OS, Indentation + " " );
448
+ }
449
+ }
450
+
451
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
416
452
};
417
453
418
454
struct LocationInfo {
@@ -421,6 +457,17 @@ struct LocationInfo {
421
457
unsigned Length = 0 ;
422
458
unsigned Line = 0 ;
423
459
unsigned Column = 0 ;
460
+
461
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
462
+ OS << Indentation << " LocationInfo" << ' \n ' ;
463
+ OS << Indentation << " Filename: " << Filename << ' \n ' ;
464
+ OS << Indentation << " Offset: " << Offset << ' \n ' ;
465
+ OS << Indentation << " Length: " << Length << ' \n ' ;
466
+ OS << Indentation << " Line: " << Line << ' \n ' ;
467
+ OS << Indentation << " Column: " << Column << ' \n ' ;
468
+ }
469
+
470
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
424
471
};
425
472
426
473
struct CursorSymbolInfo {
@@ -470,6 +517,60 @@ struct CursorSymbolInfo {
470
517
bool IsSynthesized = false ;
471
518
472
519
llvm::Optional<unsigned > ParentNameOffset;
520
+
521
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
522
+ OS << Indentation << " CursorSymbolInfo" << ' \n ' ;
523
+ OS << Indentation << " Kind: " << Kind.getName () << ' \n ' ;
524
+ OS << Indentation << " DeclarationLang: " << DeclarationLang.getName ()
525
+ << ' \n ' ;
526
+ OS << Indentation << " Name: " << Name << ' \n ' ;
527
+ OS << Indentation << " USR: " << USR << ' \n ' ;
528
+ OS << Indentation << " TypeName: " << TypeName << ' \n ' ;
529
+ OS << Indentation << " TypeUSR: " << TypeUSR << ' \n ' ;
530
+ OS << Indentation << " ContainerTypeUSR: " << ContainerTypeUSR << ' \n ' ;
531
+ OS << Indentation << " DocComment: " << DocComment << ' \n ' ;
532
+ OS << Indentation << " GroupName: " << GroupName << ' \n ' ;
533
+ OS << Indentation << " LocalizationKey: " << LocalizationKey << ' \n ' ;
534
+ OS << Indentation << " AnnotatedDeclaration: " << AnnotatedDeclaration
535
+ << ' \n ' ;
536
+ OS << Indentation
537
+ << " FullyAnnotatedDeclaration: " << FullyAnnotatedDeclaration << ' \n ' ;
538
+ OS << Indentation << " SymbolGraph: " << SymbolGraph << ' \n ' ;
539
+ OS << Indentation << " ModuleName: " << ModuleName << ' \n ' ;
540
+ OS << Indentation << " ModuleInterfaceName: " << ModuleInterfaceName
541
+ << ' \n ' ;
542
+ Location.print (OS, Indentation + " " );
543
+ OS << Indentation << " OverrideUSRs:" << ' \n ' ;
544
+ for (auto OverrideUSR : OverrideUSRs) {
545
+ OS << Indentation << " " << OverrideUSR << ' \n ' ;
546
+ }
547
+ OS << Indentation << " AnnotatedRelatedDeclarations:" << ' \n ' ;
548
+ for (auto AnnotatedRelatedDeclaration : AnnotatedRelatedDeclarations) {
549
+ OS << Indentation << " " << AnnotatedRelatedDeclaration << ' \n ' ;
550
+ }
551
+ OS << Indentation << " ModuleGroupArray:" << ' \n ' ;
552
+ for (auto ModuleGroup : ModuleGroupArray) {
553
+ OS << Indentation << " " << ModuleGroup << ' \n ' ;
554
+ }
555
+ OS << Indentation << " ParentContexts:" << ' \n ' ;
556
+ for (auto ParentContext : ParentContexts) {
557
+ ParentContext.print (OS, Indentation + " " );
558
+ }
559
+ OS << Indentation << " ReferencedSymbols:" << ' \n ' ;
560
+ for (auto ReferencedSymbol : ReferencedSymbols) {
561
+ ReferencedSymbol.print (OS, Indentation + " " );
562
+ }
563
+ OS << Indentation << " ReceiverUSRs:" << ' \n ' ;
564
+ for (auto ReceiverUSR : ReceiverUSRs) {
565
+ OS << Indentation << " " << ReceiverUSR << ' \n ' ;
566
+ }
567
+ OS << Indentation << " IsSystem: " << IsSystem << ' \n ' ;
568
+ OS << Indentation << " IsDynamic: " << IsDynamic << ' \n ' ;
569
+ OS << Indentation << " IsSynthesized: " << IsSynthesized << ' \n ' ;
570
+ OS << Indentation << " ParentNameOffset: " << ParentNameOffset << ' \n ' ;
571
+ }
572
+
573
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
473
574
};
474
575
475
576
struct CursorInfoData {
@@ -480,6 +581,20 @@ struct CursorInfoData {
480
581
llvm::ArrayRef<CursorSymbolInfo> Symbols;
481
582
// / All available actions on the code under cursor.
482
583
llvm::ArrayRef<RefactoringInfo> AvailableActions;
584
+
585
+ void print (llvm::raw_ostream &OS, std::string Indentation) const {
586
+ OS << Indentation << " CursorInfoData" << ' \n ' ;
587
+ OS << Indentation << " Symbols:" << ' \n ' ;
588
+ for (auto Symbol : Symbols) {
589
+ Symbol.print (OS, Indentation + " " );
590
+ }
591
+ OS << Indentation << " AvailableActions:" << ' \n ' ;
592
+ for (auto AvailableAction : AvailableActions) {
593
+ AvailableAction.print (OS, Indentation + " " );
594
+ }
595
+ }
596
+
597
+ SWIFT_DEBUG_DUMP { print (llvm::errs (), " " ); }
483
598
};
484
599
485
600
// / The result type of `LangSupport::getDiagnostics`
0 commit comments