mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #38939 from xymus/emit-module-separately-interface-hash
[Frontend] Generate an interface hash for emit-module-separately jobs
This commit is contained in:
@@ -1153,10 +1153,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
|
|||||||
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
|
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto typeOpts = getASTContext().TypeCheckerOpts;
|
||||||
if (forPrimary || isWholeModuleCompilation()) {
|
if (forPrimary || isWholeModuleCompilation()) {
|
||||||
// Disable delayed body parsing for primaries and in WMO, unless
|
// Disable delayed body parsing for primaries and in WMO, unless
|
||||||
// forcefully skipping function bodies
|
// forcefully skipping function bodies
|
||||||
auto typeOpts = getASTContext().TypeCheckerOpts;
|
|
||||||
if (typeOpts.SkipFunctionBodies == FunctionBodySkipping::None)
|
if (typeOpts.SkipFunctionBodies == FunctionBodySkipping::None)
|
||||||
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
|
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
|
||||||
} else {
|
} else {
|
||||||
@@ -1165,9 +1165,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
|
|||||||
opts |= SourceFile::ParsingFlags::SuppressWarnings;
|
opts |= SourceFile::ParsingFlags::SuppressWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable interface hash computation for primaries, but not in WMO, as it's
|
// Enable interface hash computation for primaries or emit-module-separately,
|
||||||
// only currently needed for incremental mode.
|
// but not in WMO, as it's only currently needed for incremental mode.
|
||||||
if (forPrimary) {
|
if (forPrimary ||
|
||||||
|
typeOpts.SkipFunctionBodies == FunctionBodySkipping::NonInlinableWithoutTypes) {
|
||||||
opts |= SourceFile::ParsingFlags::EnableInterfaceHash;
|
opts |= SourceFile::ParsingFlags::EnableInterfaceHash;
|
||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
// RUN: %target-swift-frontend -dump-interface-hash -primary-file %t/b.swift 2> %t/b.hash
|
// RUN: %target-swift-frontend -dump-interface-hash -primary-file %t/b.swift 2> %t/b.hash
|
||||||
// RUN: not cmp %t/a.hash %t/b.hash
|
// RUN: not cmp %t/a.hash %t/b.hash
|
||||||
|
|
||||||
|
/// We should generate an interface hash for emit-module-separately jobs even
|
||||||
|
/// with no primaries.
|
||||||
|
// RUN: %target-swift-frontend -dump-interface-hash %t/b.swift -experimental-skip-non-inlinable-function-bodies-without-types 2> %t/b-emit-module.hash
|
||||||
|
// RUN: cmp %t/b.hash %t/b-emit-module.hash
|
||||||
|
|
||||||
// BEGIN a.swift
|
// BEGIN a.swift
|
||||||
func f() {}
|
func f() {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user