@@ -544,47 +544,6 @@ class TypeChecker final {
544
544
private:
545
545
ASTContext &Context;
546
546
547
- // / If non-zero, warn when a function body takes longer than this many
548
- // / milliseconds to type-check.
549
- // /
550
- // / Intended for debugging purposes only.
551
- unsigned WarnLongFunctionBodies = 0 ;
552
-
553
- // / If non-zero, warn when type-checking an expression takes longer
554
- // / than this many milliseconds.
555
- // /
556
- // / Intended for debugging purposes only.
557
- unsigned WarnLongExpressionTypeChecking = 0 ;
558
-
559
- // / If non-zero, abort the expression type checker if it takes more
560
- // / than this many seconds.
561
- unsigned ExpressionTimeoutThreshold = 600 ;
562
-
563
- // / If non-zero, abort the switch statement exhaustiveness checker if
564
- // / the Space::minus function is called more than this many times.
565
- // /
566
- // / Why this number? Times out in about a second on a 2017 iMac, Retina 5K,
567
- // 4.2 GHz Intel Core i7.
568
- // (It's arbitrary, but will keep the compiler from taking too much time.)
569
- unsigned SwitchCheckingInvocationThreshold = 200000 ;
570
-
571
- // / If true, the time it takes to type-check each function will be dumped
572
- // / to llvm::errs().
573
- bool DebugTimeFunctionBodies = false ;
574
-
575
- // / If true, the time it takes to type-check each expression will be
576
- // / dumped to llvm::errs().
577
- bool DebugTimeExpressions = false ;
578
-
579
- // / Indicate that the type checker is checking code that will be
580
- // / immediately executed. This will suppress certain warnings
581
- // / when executing scripts.
582
- bool InImmediateMode = false ;
583
-
584
- // / Indicate that the type checker should skip type-checking non-inlinable
585
- // / function bodies.
586
- bool SkipNonInlinableFunctionBodies = false ;
587
-
588
547
TypeChecker (ASTContext &Ctx);
589
548
friend class ASTContext ;
590
549
friend class constraints ::ConstraintSystem;
@@ -604,90 +563,6 @@ class TypeChecker final {
604
563
605
564
LangOptions &getLangOpts () const { return Context.LangOpts ; }
606
565
607
- // / Dump the time it takes to type-check each function to llvm::errs().
608
- void enableDebugTimeFunctionBodies () {
609
- DebugTimeFunctionBodies = true ;
610
- }
611
-
612
- // / Dump the time it takes to type-check each function to llvm::errs().
613
- void enableDebugTimeExpressions () {
614
- DebugTimeExpressions = true ;
615
- }
616
-
617
- bool getDebugTimeExpressions () {
618
- return DebugTimeExpressions;
619
- }
620
-
621
- // / If \p timeInMS is non-zero, warn when a function body takes longer than
622
- // / this many milliseconds to type-check.
623
- // /
624
- // / Intended for debugging purposes only.
625
- void setWarnLongFunctionBodies (unsigned timeInMS) {
626
- WarnLongFunctionBodies = timeInMS;
627
- }
628
-
629
- // / If \p timeInMS is non-zero, warn when type-checking an expression
630
- // / takes longer than this many milliseconds.
631
- // /
632
- // / Intended for debugging purposes only.
633
- void setWarnLongExpressionTypeChecking (unsigned timeInMS) {
634
- WarnLongExpressionTypeChecking = timeInMS;
635
- }
636
-
637
- // / Return the current setting for the number of milliseconds
638
- // / threshold we use to determine whether to warn about an
639
- // / expression taking a long time.
640
- unsigned getWarnLongExpressionTypeChecking () {
641
- return WarnLongExpressionTypeChecking;
642
- }
643
-
644
- // / Set the threshold that determines the upper bound for the number
645
- // / of seconds we'll let the expression type checker run before
646
- // / considering an expression "too complex".
647
- void setExpressionTimeoutThreshold (unsigned timeInSeconds) {
648
- ExpressionTimeoutThreshold = timeInSeconds;
649
- }
650
-
651
- // / Return the current setting for the threshold that determines
652
- // / the upper bound for the number of seconds we'll let the
653
- // / expression type checker run before considering an expression
654
- // / "too complex".
655
- // / If zero, do not limit the checking.
656
- unsigned getExpressionTimeoutThresholdInSeconds () {
657
- return ExpressionTimeoutThreshold;
658
- }
659
-
660
- // / Get the threshold that determines the upper bound for the number
661
- // / of times we'll let the Space::minus routine run before
662
- // / considering a switch statement "too complex".
663
- // / If zero, do not limit the checking.
664
- unsigned getSwitchCheckingInvocationThreshold () const {
665
- return SwitchCheckingInvocationThreshold;
666
- }
667
-
668
- // / Set the threshold that determines the upper bound for the number
669
- // / of times we'll let the Space::minus routine run before
670
- // / considering a switch statement "too complex".
671
- void setSwitchCheckingInvocationThreshold (unsigned invocationCount) {
672
- SwitchCheckingInvocationThreshold = invocationCount;
673
- }
674
-
675
- void setSkipNonInlinableBodies (bool skip) {
676
- SkipNonInlinableFunctionBodies = skip;
677
- }
678
-
679
- bool canSkipNonInlinableBodies () const {
680
- return SkipNonInlinableFunctionBodies;
681
- }
682
-
683
- bool getInImmediateMode () {
684
- return InImmediateMode;
685
- }
686
-
687
- void setInImmediateMode (bool InImmediateMode) {
688
- this ->InImmediateMode = InImmediateMode;
689
- }
690
-
691
566
static Type getArraySliceType (SourceLoc loc, Type elementType);
692
567
static Type getDictionaryType (SourceLoc loc, Type keyType, Type valueType);
693
568
static Type getOptionalType (SourceLoc loc, Type elementType);
0 commit comments