mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Dependencies: start tracking whether a lookup is private to a file or not.
This is sort of two commits squashed into one: first, update ReferencedNameTracker to record whether a name or type is non-private, along with changing all clients to assume non-private; and second, actually try to (conservatively) decide if a particular unqualified lookup can be considered private. What does "private" mean? That means that a dependency does not affect "downstream" files. For example, if file A depends on B, and B depends on C, then a change in C normally means A will get rebuilt. But if B's dependencies on C are all private dependencies (e.g. lookups from within function bodies), then A does not need to be rebuilt. In practice there are several rules about when we can make this assumption, and a few places where our current DeclContext model is not good enough to distinguish private uses from non-private uses. In these cases we have to be conservative and assume that the use is non-private (and thus that downstream files will need to be rebuilt). Part of rdar://problem/15353101 Swift SVN r23447
This commit is contained in:
@@ -1134,8 +1134,9 @@ SourceFile::lookup##Kind##Operator(Identifier name, SourceLoc loc) { \
|
||||
auto result = lookupOperatorDeclForName(*this, loc, name, true, \
|
||||
&SourceFile::Kind##Operators); \
|
||||
if (result.hasValue() && !result.getValue()) { \
|
||||
/* FIXME: Track whether this is a private use or not. */ \
|
||||
if (ReferencedNames) \
|
||||
ReferencedNames->addTopLevelName(name); \
|
||||
ReferencedNames->addTopLevelName(name, true); \
|
||||
result = lookupOperatorDeclForName(getParentModule(), loc, name, \
|
||||
&SourceFile::Kind##Operators); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user