Skip to content

Commit fdc7485

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

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
@@ -1156,10 +1156,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
11561156
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
11571157
}
11581158

1159+
auto typeOpts = getASTContext().TypeCheckerOpts;
11591160
if (forPrimary || isWholeModuleCompilation()) {
11601161
// Disable delayed body parsing for primaries and in WMO, unless
11611162
// forcefully skipping function bodies
1162-
auto typeOpts = getASTContext().TypeCheckerOpts;
11631163
if (typeOpts.SkipFunctionBodies == FunctionBodySkipping::None)
11641164
opts |= SourceFile::ParsingFlags::DisableDelayedBodies;
11651165
} else {
@@ -1168,9 +1168,10 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
11681168
opts |= SourceFile::ParsingFlags::SuppressWarnings;
11691169
}
11701170

1171-
// Enable interface hash computation for primaries, but not in WMO, as it's
1172-
// only currently needed for incremental mode.
1173-
if (forPrimary) {
1171+
// Enable interface hash computation for primaries or emit-module-separately,
1172+
// but not in WMO, as it's only currently needed for incremental mode.
1173+
if (forPrimary ||
1174+
typeOpts.SkipFunctionBodies == FunctionBodySkipping::NonInlinableWithoutTypes) {
11741175
opts |= SourceFile::ParsingFlags::EnableInterfaceHash;
11751176
}
11761177
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)