@@ -429,7 +429,7 @@ class Instrumenter : InstrumenterBase {
429
429
++EI;
430
430
}
431
431
}
432
- } else {
432
+ } else if ( shouldLogType (AE-> getSrc ()-> getType ())) {
433
433
std::pair<PatternBindingDecl *, VarDecl *> PV =
434
434
buildPatternAndVariable (AE->getSrc ());
435
435
DeclRefExpr *DRE = new (Context)
@@ -521,7 +521,7 @@ class Instrumenter : InstrumenterBase {
521
521
}
522
522
Handled = true ; // Never log ()
523
523
}
524
- if (!Handled) {
524
+ if (!Handled && shouldLogType (E-> getType ()) ) {
525
525
// do the same as for all other expressions
526
526
std::pair<PatternBindingDecl *, VarDecl *> PV =
527
527
buildPatternAndVariable (E);
@@ -539,7 +539,7 @@ class Instrumenter : InstrumenterBase {
539
539
}
540
540
}
541
541
} else {
542
- if (E->getType ()->getCanonicalType () != Context.TheEmptyTupleType ) {
542
+ if (E->getType ()->getCanonicalType () != Context.TheEmptyTupleType && shouldLogType (E-> getType ()) ) {
543
543
std::pair<PatternBindingDecl *, VarDecl *> PV =
544
544
buildPatternAndVariable (E);
545
545
Added<Stmt *> Log = buildLoggerCall (
@@ -559,7 +559,7 @@ class Instrumenter : InstrumenterBase {
559
559
} else if (auto *S = Element.dyn_cast <Stmt *>()) {
560
560
S->walk (CF);
561
561
if (auto *RS = dyn_cast<ReturnStmt>(S)) {
562
- if (RS->hasResult ()) {
562
+ if (RS->hasResult () && shouldLogType (RS-> getResult ()-> getType ()) ) {
563
563
std::pair<PatternBindingDecl *, VarDecl *> PV =
564
564
buildPatternAndVariable (RS->getResult ());
565
565
DeclRefExpr *DRE = new (Context) DeclRefExpr (
@@ -621,7 +621,7 @@ class Instrumenter : InstrumenterBase {
621
621
if (PL && Options.LogFunctionParameters ) {
622
622
size_t EI = 0 ;
623
623
for (const auto &PD : *PL) {
624
- if (PD->hasName ()) {
624
+ if (PD->hasName () && shouldLogType (PD-> getInterfaceType ()) ) {
625
625
DeclBaseName Name = PD->getName ();
626
626
Expr *PVVarRef = new (Context)
627
627
DeclRefExpr (PD, DeclNameLoc (), /* implicit=*/ true ,
@@ -658,6 +658,10 @@ class Instrumenter : InstrumenterBase {
658
658
// after or instead of the expression they're looking at. Only call this
659
659
// if the variable has an initializer.
660
660
Added<Stmt *> logVarDecl (VarDecl *VD) {
661
+ if (!shouldLogType (VD->getInterfaceType ())) {
662
+ return nullptr ;
663
+ }
664
+
661
665
if (isa<ConstructorDecl>(TypeCheckDC) && VD->getNameStr ().equals (" self" )) {
662
666
// Don't log "self" in a constructor
663
667
return nullptr ;
@@ -674,6 +678,10 @@ class Instrumenter : InstrumenterBase {
674
678
if (auto *DRE = dyn_cast<DeclRefExpr>(*RE)) {
675
679
VarDecl *VD = cast<VarDecl>(DRE->getDecl ());
676
680
681
+ if (!shouldLogType (VD->getInterfaceType ())) {
682
+ return nullptr ;
683
+ }
684
+
677
685
if (isa<ConstructorDecl>(TypeCheckDC) && VD->getBaseName () == " self" ) {
678
686
// Don't log "self" in a constructor
679
687
return nullptr ;
@@ -686,6 +694,11 @@ class Instrumenter : InstrumenterBase {
686
694
} else if (auto *MRE = dyn_cast<MemberRefExpr>(*RE)) {
687
695
Expr *B = MRE->getBase ();
688
696
ConcreteDeclRef M = MRE->getMember ();
697
+ VarDecl *VD = cast<VarDecl>(M.getDecl ());
698
+
699
+ if (!shouldLogType (VD->getInterfaceType ())) {
700
+ return nullptr ;
701
+ }
689
702
690
703
if (isa<ConstructorDecl>(TypeCheckDC) && digForName (B) == " self" ) {
691
704
// Don't log attributes of "self" in a constructor
@@ -786,6 +799,14 @@ class Instrumenter : InstrumenterBase {
786
799
return std::make_pair (PBD, VD);
787
800
}
788
801
802
+ bool shouldLogType (Type Ty) {
803
+ // Don't try to log ~Copyable types, as we can't pass them to the generic logging functions yet.
804
+ if (Ty->isNoncopyable ()) {
805
+ return false ;
806
+ }
807
+ return true ;
808
+ }
809
+
789
810
Added<Stmt *> buildLoggerCall (Added<Expr *> E, SourceRange SR,
790
811
StringRef Name) {
791
812
Expr *NameExpr = new (Context) StringLiteralExpr (
0 commit comments