-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Frontend: add a front-end option to specify module names for which we prefer loading via interfaces #26894
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
Frontend: add a front-end option to specify module names for which we prefer loading via interfaces #26894
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1435,11 +1435,14 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory( | |
} | ||
|
||
// Create an instance of the Impl to do the heavy lifting. | ||
auto ModuleName = ModuleID.first.str(); | ||
ParseableInterfaceModuleLoaderImpl Impl( | ||
Ctx, ModPath, InPath, ModuleID.first.str(), | ||
Ctx, ModPath, InPath, ModuleName, | ||
CacheDir, PrebuiltCacheDir, ModuleID.second, | ||
RemarkOnRebuildFromInterface, dependencyTracker, | ||
LoadMode); | ||
llvm::is_contained(PreferInterfaceForModules, | ||
ModuleName)? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing a space again. |
||
ModuleLoadingMode::PreferParseable : LoadMode); | ||
|
||
// Ask the impl to find us a module that we can load or give us an error | ||
// telling us that we couldn't load it. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cake: Func FrozenKind.__derived_enum_equals(_:_:) has been removed | ||
cake: Accessor GlobalLetChangedToVar.Get() is a new API without @available attribute | ||
cake: Accessor GlobalVarChangedToLet.Get() is a new API without @available attribute | ||
cake: Accessor GlobalVarChangedToLet.Modify() is a new API without @available attribute | ||
cake: Accessor GlobalVarChangedToLet.Set() is a new API without @available attribute | ||
cake: Class C4 is now with @objc | ||
cake: Enum FrozenKind is now with @frozen | ||
cake: Enum IceKind is now with @frozen | ||
cake: Func FrozenKind.==(_:_:) is a new API without @available attribute | ||
cake: Var C1.CIIns1 is no longer a stored property | ||
cake: Var C1.CIIns2 is no longer a stored property | ||
cake: Var RemoveSetters.Value is no longer a stored property |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: %empty-directory(%t.mod1) | ||
// RUN: %empty-directory(%t.mod2) | ||
// RUN: %empty-directory(%t.sdk) | ||
// RUN: %empty-directory(%t.module-cache) | ||
|
||
// Generate .swiftinterface file for module cake | ||
// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache | ||
|
||
// Generate .swiftmodule file for module cake | ||
// RUN: %target-swift-frontend -emit-module -o %t.mod1/cake.swiftmodule %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see. You forgot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the other changes should not happen, and if they do that's a problem. |
||
|
||
// Dump Json file for cake ABI via .swiftmodule file | ||
// RUN: %api-digester -dump-sdk -module cake -o - -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod1 -I %S/Inputs/APINotesLeft -abi > %t.dump1.json | ||
|
||
// Dump Json file for cake ABI via .swiftinteface file | ||
// RUN: %api-digester -dump-sdk -module cake -o - -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod1 -I %S/Inputs/APINotesLeft -abi -use-interface-for-module cake > %t.dump2.json | ||
|
||
// Compare two Json files and we should see some differences. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we seeing differences here? It looks like you're building the swiftmodule and the swiftinterface from the same build settings, so they should have identical public contents. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notice here we are comparing two Json files: the first Json file is a dump from loading the interface; the second Json file is a dump from loading the binary format generated directly from the source code. The difference is due to that source-generated swiftmodule files can diverge from the swiftmodule files generated from interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they do, that's a bug. How are these differences coming up? |
||
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -abi -o %t.result | ||
|
||
// RUN: %clang -E -P -x c %S/Outputs/Cake-interface-vs-binary.txt -o - | sed '/^\s*$/d' > %t.expected | ||
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.result.tmp | ||
// RUN: diff -u %t.expected %t.result.tmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this the first time around. This doesn't belong in SerializedModuleLoaderBase; please move it up to ParseableInterfaceModuleLoader.