Skip to content

Remove Type Body Fingerprints Flags #34151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions include/swift/AST/AbstractSourceFileDepGraphFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ namespace fine_grained_dependencies {
/// \c SourceFile or a unit test
class AbstractSourceFileDepGraphFactory {
protected:
/// To match the existing system, set this to false.
/// To include even private entities and get intra-file info, set to true.
const bool includePrivateDeps;

/// If there was an error, cannot get accurate info.
const bool hadCompilationError;

Expand All @@ -48,8 +44,7 @@ class AbstractSourceFileDepGraphFactory {
public:
/// Expose this layer to enable faking up a constructor for testing.
/// See the instance variable comments for explanation.
AbstractSourceFileDepGraphFactory(bool includePrivateDeps,
bool hadCompilationError,
AbstractSourceFileDepGraphFactory(bool hadCompilationError,
StringRef swiftDeps,
StringRef fileFingerprint,
bool emitDotFileAfterConstruction,
Expand Down
3 changes: 0 additions & 3 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,6 @@ class alignas(1 << DeclAlignInBits) Decl {
/// If this returns true, the decl can be safely casted to ValueDecl.
bool isPotentiallyOverridable() const;

/// Returns true if this Decl cannot be seen by any other source file
bool isPrivateToEnclosingFile() const;

/// If an alternative module name is specified for this decl, e.g. using
/// @_originalDefinedIn attribute, this function returns this module name.
StringRef getAlternateModuleName() const;
Expand Down
11 changes: 0 additions & 11 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,10 @@ namespace swift {
/// of active clauses aren't hoisted into the enclosing scope.
bool DisablePoundIfEvaluation = false;

/// Instead of hashing tokens inside of NominalType and ExtensionBodies into
/// the interface hash, hash them into per-iterable-decl-context
/// fingerprints. Fine-grained dependency types won't dirty every provides
/// in a file when the user adds a member to, e.g., a struct.
bool EnableTypeFingerprints = true;

/// When using fine-grained dependencies, emit dot files for every swiftdeps
/// file.
bool EmitFineGrainedDependencySourcefileDotFiles = false;

/// To mimic existing system, set to false.
/// To experiment with including file-private and private dependency info,
/// set to true.
bool FineGrainedDependenciesIncludeIntrafileOnes = false;

/// Whether to enable experimental differentiable programming features:
/// `@differentiable` declaration attribute, etc.
bool EnableExperimentalDifferentiableProgramming = false;
Expand Down
15 changes: 0 additions & 15 deletions include/swift/Driver/Compilation.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,13 @@ class Compilation {
const bool OnlyOneDependencyFile;

private:
/// Is the parser recording token hashes for each type body?
const bool EnableTypeFingerprints;

/// Helpful for debugging, but slows down the driver. So, only turn on when
/// needed.
const bool VerifyFineGrainedDependencyGraphAfterEveryImport;
/// Helpful for debugging, but slows down the driver. So, only turn on when
/// needed.
const bool EmitFineGrainedDependencyDotFileAfterEveryImport;

/// Experiment with intrafile dependencies
const bool FineGrainedDependenciesIncludeIntrafileOnes;

/// Experiment with source-range-based dependencies
const bool EnableSourceRangeDependencies;

Expand Down Expand Up @@ -319,11 +313,8 @@ class Compilation {
bool ShowDriverTimeCompilation = false,
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
bool OnlyOneDependencyFile = false,
bool EnableTypeFingerprints =
LangOptions().EnableTypeFingerprints,
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
bool FineGrainedDependenciesIncludeIntrafileOnes = false,
bool EnableSourceRangeDependencies = false,
bool CompareIncrementalSchemes = false,
StringRef CompareIncrementalSchemesPath = "",
Expand Down Expand Up @@ -386,8 +377,6 @@ class Compilation {
}
void disableIncrementalBuild(Twine why);

bool getEnableTypeFingerprints() const { return EnableTypeFingerprints; }

bool getVerifyFineGrainedDependencyGraphAfterEveryImport() const {
return VerifyFineGrainedDependencyGraphAfterEveryImport;
}
Expand All @@ -396,10 +385,6 @@ class Compilation {
return EmitFineGrainedDependencyDotFileAfterEveryImport;
}

bool getFineGrainedDependenciesIncludeIntrafileOnes() const {
return FineGrainedDependenciesIncludeIntrafileOnes;
}

bool getEnableSourceRangeDependencies() const {
return EnableSourceRangeDependencies;
}
Expand Down
9 changes: 2 additions & 7 deletions include/swift/Driver/FineGrainedDependencyDriverGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ class ModuleDepGraph {
const bool verifyFineGrainedDependencyGraphAfterEveryImport;
const bool emitFineGrainedDependencyDotFileAfterEveryImport;

const bool EnableTypeFingerprints;

private:
/// If tracing dependencies, holds a vector used to hold the current path
/// def - use/def - use/def - ...
Expand Down Expand Up @@ -296,14 +294,12 @@ class ModuleDepGraph {
/// \p stats may be null
ModuleDepGraph(const bool verifyFineGrainedDependencyGraphAfterEveryImport,
const bool emitFineGrainedDependencyDotFileAfterEveryImport,
const bool EnableTypeFingerprints,
const bool shouldTraceDependencies,
UnifiedStatsReporter *stats)
: verifyFineGrainedDependencyGraphAfterEveryImport(
verifyFineGrainedDependencyGraphAfterEveryImport),
emitFineGrainedDependencyDotFileAfterEveryImport(
emitFineGrainedDependencyDotFileAfterEveryImport),
EnableTypeFingerprints(EnableTypeFingerprints),
currentPathIfTracing(
shouldTraceDependencies
? llvm::Optional<std::vector<const ModuleDepGraphNode *>>(
Expand All @@ -314,11 +310,10 @@ class ModuleDepGraph {
}

/// For unit tests.
ModuleDepGraph(const bool EnableTypeFingerprints,
const bool EmitDotFilesForDebugging = false)
ModuleDepGraph(const bool EmitDotFilesForDebugging = false)
: ModuleDepGraph(
true, /*emitFineGrainedDependencyDotFileAfterEveryImport=*/
EmitDotFilesForDebugging, EnableTypeFingerprints, false, nullptr) {}
EmitDotFilesForDebugging, false, nullptr) {}

//============================================================================
// MARK: ModuleDepGraph - updating from a switdeps file
Expand Down
13 changes: 0 additions & 13 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ def driver_always_rebuild_dependents :
Flag<["-"], "driver-always-rebuild-dependents">, InternalDebugOpt,
HelpText<"Always rebuild dependents of files that have been modified">;

def enable_type_fingerprints :
Flag<["-"], "enable-type-fingerprints">, Flags<[FrontendOption, HelpHidden]>,
HelpText<"Enable per-nominal and extension body fingerprints">;

def disable_type_fingerprints :
Flag<["-"], "disable-type-fingerprints">, Flags<[FrontendOption, HelpHidden]>,
HelpText<"Disable per-nominal and extension body fingerprints">;

def enable_only_one_dependency_file :
Flag<["-"], "enable-only-one-dependency-file">, Flags<[DoesNotAffectIncrementalBuild]>,
HelpText<"Enables incremental build optimization that only produces one dependencies file">;
Expand Down Expand Up @@ -190,11 +182,6 @@ Flag<["-"], "driver-emit-fine-grained-dependency-dot-file-after-every-import">,
InternalDebugOpt,
HelpText<"Emit dot files every time driver imports an fine-grained swiftdeps file.">;

def fine_grained_dependency_include_intrafile :
Flag<["-"], "fine-grained-dependency-include-intrafile">,
Flags<[FrontendOption, HelpHidden]>,
HelpText<"Include within-file dependencies.">;

def emit_fine_grained_dependency_sourcefile_dot_files :
Flag<["-"], "emit-fine-grained-dependency-sourcefile-dot-files">,
Flags<[FrontendOption, HelpHidden]>,
Expand Down
5 changes: 2 additions & 3 deletions lib/AST/AbstractSourceFileDepGraphFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ using namespace fine_grained_dependencies;
//==============================================================================

AbstractSourceFileDepGraphFactory::AbstractSourceFileDepGraphFactory(
bool includePrivateDeps, bool hadCompilationError, StringRef swiftDeps,
bool hadCompilationError, StringRef swiftDeps,
StringRef fileFingerprint, bool emitDotFileAfterConstruction,
DiagnosticEngine &diags)
: includePrivateDeps(includePrivateDeps),
hadCompilationError(hadCompilationError), swiftDeps(swiftDeps.str()),
: hadCompilationError(hadCompilationError), swiftDeps(swiftDeps.str()),
fileFingerprint(fileFingerprint.str()),
emitDotFileAfterConstruction(emitDotFileAfterConstruction), diags(diags) {
}
Expand Down
23 changes: 0 additions & 23 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8098,26 +8098,3 @@ void swift::simple_display(llvm::raw_ostream &out, AnyFunctionRef fn) {
else
out << "closure";
}

bool Decl::isPrivateToEnclosingFile() const {
if (auto *VD = dyn_cast<ValueDecl>(this))
return VD->getFormalAccess() <= AccessLevel::FilePrivate;
switch (getKind()) {
case DeclKind::Import:
case DeclKind::PatternBinding:
case DeclKind::EnumCase:
case DeclKind::TopLevelCode:
case DeclKind::IfConfig:
case DeclKind::PoundDiagnostic:
return true;

case DeclKind::Extension:
case DeclKind::InfixOperator:
case DeclKind::PrefixOperator:
case DeclKind::PostfixOperator:
return false;

default:
llvm_unreachable("everything else is a ValueDecl");
}
}
2 changes: 1 addition & 1 deletion lib/AST/DeclContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ bool IterableDeclContext::areTokensHashedForThisBodyInsteadOfInterfaceHash()
// corresponding to the fingerprinted nominal dependency node.
if (isa<ExtensionDecl>(this))
return false;
return getASTContext().LangOpts.EnableTypeFingerprints;
return true;
}

/// Return the DeclContext to compare when checking private access in
Expand Down
Loading