Skip to content

Commit 1f1aa3e

Browse files
committed
[Frontend] Generate an interface has for emit-module-separately jobs
1 parent fc5fa85 commit 1f1aa3e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
11441144
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
11451145
}
11461146

1147+
auto typeOpts = getASTContext().TypeCheckerOpts;
11471148
if (forPrimary || isWholeModuleCompilation()) {
11481149
// Disable delayed body parsing for primaries and in WMO, unless
11491150
// forcefully skipping function bodies
1150-
auto typeOpts = getASTContext().TypeCheckerOpts;
11511151
if (typeOpts.SkipFunctionBodies == FunctionBodySkipping::None)
11521152
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
11531153
} else {
@@ -1156,9 +1156,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
11561156
opts |= SourceFile::ParsingFlags::SuppressWarnings;
11571157
}
11581158

1159-
// Enable interface hash computation for primaries, but not in WMO, as it's
1160-
// only currently needed for incremental mode.
1161-
if (forPrimary) {
1159+
// Enable interface hash computation for primaries or emit-module-separately,
1160+
// but not in WMO, as it's only currently needed for incremental mode.
1161+
if (forPrimary ||
1162+
typeOpts.SkipFunctionBodies == FunctionBodySkipping::NonInlinableWithoutTypes) {
11621163
opts |= SourceFile::ParsingFlags::EnableInterfaceHash;
11631164
}
11641165
return opts;

test/InterfaceHash/added_function.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
// RUN: %target-swift-frontend -dump-interface-hash -primary-file %t/b.swift 2> %t/b.hash
55
// RUN: not cmp %t/a.hash %t/b.hash
66

7+
/// We should generate an interface hash for emit-module-separately jobs even
8+
/// with no primaries.
9+
// RUN: %target-swift-frontend -dump-interface-hash %t/b.swift -experimental-skip-non-inlinable-function-bodies-without-types 2> %t/b-emit-module.hash
10+
// RUN: cmp %t/b.hash %t/b-emit-module.hash
11+
712
// BEGIN a.swift
813
func f() {}
914

0 commit comments

Comments
 (0)