Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 256346b

Browse files
author
TensorFlow SyncBot
committed
Merge branch 'master' of github.com:apple/swift into tensorflow-stage
* 'master' of github.com:apple/swift: [SILGen] Emit unreachable code diagnostic for single expression closures with implicit returns too (swiftlang#33604) Resolve ASTScope Issues [NFC] Only Register Primaries As Dependency Sources Drop Legacy Tests Remove DependencyRecorder::Mode Remove appendHolderOfCascadingMembers Remove LegacyCascadingDependencies Remove Cascading Computations from ASTScope Remove unnecessary dependency sources Remove Reference::cascades Remove DependencyScope Remove evaluator::getScopeForAccessLevel Remove DeclContext::isCascadingContextForLookup Remove NLOptions::NL_Known* Remove NameLookupFlags::KnownPrivate Remove UnqualifiedLookupFlags::KnownPrivate Remove TypeResolutionFlags::KnownNonCascadingDependency [leaks-checker] Add verbose flag to dump out raw output from runtime to help debug failures on bots.
2 parents 2fb15e7 + 6ef4b0d commit 256346b

File tree

433 files changed

+488
-9980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+488
-9980
lines changed

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ class LeaksRunnerResult(perf_test_driver.Result):
6262

6363

6464
class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
65-
def __init__(self, binary, xfail_list, num_samples, num_iters):
65+
def __init__(self, binary, xfail_list, num_samples, num_iters, verbose):
6666
perf_test_driver.BenchmarkDriver.__init__(
6767
self, binary, xfail_list, enable_parallel=True
6868
)
6969
self.num_samples = num_samples
7070
self.num_iters = num_iters
71+
self.verbose = verbose
7172

7273
def print_data_header(self, max_test_len):
7374
fmt = "{:<%d}{:<10}{:}" % (max_test_len + 5)
@@ -120,6 +121,13 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
120121
]
121122
d["objc_count"] = len(d["objc_objects"])
122123

124+
# If we are asked to emit verbose output, do so now.
125+
if self.verbose:
126+
tmp = (data["path"], data["test_name"], d)
127+
sys.stderr.write(
128+
"VERBOSE (%s,%s): %s" % tmp)
129+
sys.stderr.flush()
130+
123131
total_count = d["objc_count"] + d["swift_count"]
124132
return total_count
125133
except Exception:
@@ -156,13 +164,17 @@ def parse_args():
156164
)
157165
parser.add_argument("-num-samples", type=int, default=2)
158166
parser.add_argument("-num-iters", type=int, default=2)
167+
parser.add_argument("-v", "--verbose", action="store_true",
168+
help="Upon failure, dump out raw result",
169+
dest="verbose")
159170
return parser.parse_args()
160171

161172

162173
if __name__ == "__main__":
163174
args = parse_args()
164175
driver = LeaksRunnerBenchmarkDriver(
165-
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters
176+
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters,
177+
args.verbose
166178
)
167179
if driver.run(args.filter):
168180
sys.exit(0)

include/swift/AST/ASTScope.h

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,6 @@ class ASTScopeImpl {
417417
static llvm::SmallVector<LabeledStmt *, 4>
418418
lookupLabeledStmts(SourceFile *sourceFile, SourceLoc loc);
419419

420-
static Optional<bool>
421-
computeIsCascadingUse(ArrayRef<const ASTScopeImpl *> history,
422-
Optional<bool> initialIsCascadingUse);
423-
424420
static std::pair<CaseStmt *, CaseStmt *>
425421
lookupFallthroughSourceAndDest(SourceFile *sourceFile, SourceLoc loc);
426422

@@ -448,7 +444,6 @@ class ASTScopeImpl {
448444
/// The main (recursive) lookup function:
449445
/// Tell DeclConsumer about all names found in this scope and if not done,
450446
/// recurse for enclosing scopes. Stop lookup if about to look in limit.
451-
/// Return final value for isCascadingUse
452447
///
453448
/// If the lookup depends on implicit self, selfDC is its context.
454449
/// (Names in extensions never depend on self.)
@@ -508,9 +503,6 @@ class ASTScopeImpl {
508503

509504
#pragma mark - - lookup- local bindings
510505
protected:
511-
virtual Optional<bool>
512-
resolveIsCascadingUseForThisScope(Optional<bool>) const;
513-
514506
// A local binding is a basically a local variable defined in that very scope
515507
// It is not an instance variable or inherited type.
516508

@@ -611,11 +603,11 @@ class Portion {
611603
virtual ASTScopeImpl *expandScope(GenericTypeOrExtensionScope *,
612604
ScopeCreator &) const = 0;
613605

606+
/// \Returns \c true if this lookup is done looking for results, else \c false.
614607
virtual SourceRange
615608
getChildlessSourceRangeOf(const GenericTypeOrExtensionScope *scope,
616609
bool omitAssertions) const = 0;
617610

618-
/// Returns isDone and isCascadingUse
619611
virtual bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
620612
ArrayRef<const ASTScopeImpl *>,
621613
ASTScopeImpl::DeclConsumer consumer) const;
@@ -780,10 +772,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
780772
virtual bool doesDeclHaveABody() const;
781773
const char *portionName() const { return portion->portionName; }
782774

783-
protected:
784-
Optional<bool> resolveIsCascadingUseForThisScope(
785-
Optional<bool> isCascadingUse) const override;
786-
787775
public:
788776
// Only for DeclScope, not BodyScope
789777
// Returns the where clause scope, or the parent if none
@@ -969,8 +957,6 @@ class GenericParamScope final : public ASTScopeImpl {
969957
protected:
970958
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
971959
DeclConsumer) const override;
972-
Optional<bool>
973-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
974960
};
975961

976962
/// Concrete class for a function/initializer/deinitializer
@@ -1014,9 +1000,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {
10141000

10151001
protected:
10161002
NullablePtr<const GenericParamList> genericParams() const override;
1017-
1018-
Optional<bool>
1019-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
10201003
};
10211004

10221005
/// The parameters for an abstract function (init/func/deinit)., subscript, and
@@ -1087,8 +1070,6 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
10871070
protected:
10881071
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
10891072
DeclConsumer) const override;
1090-
Optional<bool>
1091-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
10921073

10931074
public:
10941075
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
@@ -1123,10 +1104,6 @@ class DefaultArgumentInitializerScope final : public ASTScopeImpl {
11231104
virtual NullablePtr<DeclContext> getDeclContext() const override;
11241105
virtual NullablePtr<Decl> getDeclIfAny() const override { return decl; }
11251106
Decl *getDecl() const { return decl; }
1126-
1127-
protected:
1128-
Optional<bool>
1129-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
11301107
};
11311108

11321109
/// Consider:
@@ -1274,9 +1251,6 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
12741251
protected:
12751252
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
12761253
DeclConsumer) const override;
1277-
1278-
Optional<bool>
1279-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
12801254
};
12811255

12821256
/// The scope introduced by a conditional clause in an if/guard/while
@@ -1402,8 +1376,6 @@ class ClosureParametersScope final : public ASTScopeImpl {
14021376
protected:
14031377
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
14041378
DeclConsumer) const override;
1405-
Optional<bool> resolveIsCascadingUseForThisScope(
1406-
Optional<bool> isCascadingUse) const override;
14071379
};
14081380

14091381
class TopLevelCodeScope final : public ASTScopeImpl {

include/swift/AST/DeclContext.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,14 +508,6 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
508508
/// FIXME: do this for Protocols, too someday
509509
bool canBeParentOfExtension() const;
510510

511-
/// Returns true if lookups within this context could affect downstream files.
512-
///
513-
/// \param functionsAreNonCascading If true, functions are considered non-
514-
/// cascading contexts. If false, functions are considered non-cascading only
515-
/// if implicitly or explicitly marked private. When concerned only with a
516-
/// function's body, pass true.
517-
bool isCascadingContextForLookup(bool functionsAreNonCascading) const;
518-
519511
/// Look for the set of declarations with the given name within a type,
520512
/// its extensions and, optionally, its supertypes.
521513
///

0 commit comments

Comments
 (0)