Skip to content

[Serialization] Support Swift only system module #24620

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented May 8, 2019

Previously ModuleDecl::isSystemModule() returns true only if the module is:

  • Standard library
  • Clang module and that is IsSystem
  • Swift overlay for clang IsSystem module

With this patch, now:

  • Clang module and that is IsSystem; or
  • Swift overlay for clang IsSystem module
  • Swift module found in either of these directories:
    • Runtime library directoris (including stdlib)
    • Frameworks in -Fsystem directories
    • Frameworks in $SDKROOT/System/Library/Frameworks/ (Darwin)
    • Frameworks in $SDKROOT/Library/Frameworks/ (Darwin)

rdar://problem/50516314

@rintaro rintaro force-pushed the serialization-swiftonly-system-module branch from 4a5ad4c to fcaf92a Compare May 8, 2019 21:28
@@ -13,6 +13,7 @@
key.name: "SwiftOnoneSupport",
key.filepath: SwiftOnoneSupport.swiftmodule,
key.hash: <hash>,
key.is_system: 1,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftOnoneSupport is now system module.

@rintaro
Copy link
Member Author

rintaro commented May 8, 2019

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented May 8, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2019

Build failed
Swift Test Linux Platform
Git Sha - fcaf92a643f00c5efba62677a9a98bb91b439e27

@@ -547,6 +557,10 @@ FileUnit *SerializedModuleLoaderBase::loadAST(
loadInfo.status =
loadedModuleFile->associateWithFileContext(fileUnit, diagLocOrInvalid,
treatAsPartialModule);
if (auto shadowded = loadedModuleFile->getShadowedModule())
if (shadowded->isSystemModule())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong—whether or not a Swift overlay is a system module isn't really dependent on whether the underlying thing is a system module. Is this needed, given that we treat the resource search paths as system search paths now?

Also, typo: "shadowded".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for users to create their own 'user' overlays of system frameworks ?

Copy link
Member Author

@rintaro rintaro May 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's really needed. I added it just to keep the current behavior. Otherwise bunch of tests fails.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for users to create their own 'user' overlays of system frameworks ?

Possible, yes; supported, not really. And in that case, calling them "system" would be misleading.

I guess since this is the current behavior we can fix it later. Can you leave a comment, at least?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave a comment, at least?

Sure. And I'll fix typo.

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2019

Build failed
Swift Test OS X Platform
Git Sha - fcaf92a643f00c5efba62677a9a98bb91b439e27

Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
@rintaro rintaro force-pushed the serialization-swiftonly-system-module branch from fcaf92a to d3d30ee Compare May 9, 2019 00:03
@rintaro
Copy link
Member Author

rintaro commented May 9, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 9, 2019

Build failed
Swift Test Linux Platform
Git Sha - fcaf92a643f00c5efba62677a9a98bb91b439e27

@swift-ci
Copy link
Contributor

swift-ci commented May 9, 2019

Build failed
Swift Test OS X Platform
Git Sha - fcaf92a643f00c5efba62677a9a98bb91b439e27

@rintaro
Copy link
Member Author

rintaro commented May 9, 2019

Hm, Linux failure looks like c-index-test(IndexDataStore) issue.
I reproduced the failure in my Linux machine, and it's resolved if I apply this patch:

diff --git a/lib/IndexDataStore/IndexDataStore.cpp b/lib/IndexDataStore/IndexDataStore.cpp
index ec7a346935..6f207b4d95 100644
--- a/lib/IndexDataStore/IndexDataStore.cpp
+++ b/lib/IndexDataStore/IndexDataStore.cpp
@@ -85,7 +85,7 @@ bool IndexDataStoreImpl::foreachUnitName(bool sorted,
   }
 
   if (sorted) {
-    llvm::array_pod_sort(filenames.begin(), filenames.end());
+    std::sort(filenames.begin(), filenames.end());
     for (auto &fname : filenames)
       if (!receiver(fname))
         return false;

https://github.com/apple/swift-clang/blob/cd1c5c90d3d0/lib/IndexDataStore/IndexDataStore.cpp#L88
I believe std::string is not POD. @akyrtzi ?

@rintaro
Copy link
Member Author

rintaro commented May 9, 2019

apple/swift-clang#312
@swift-ci Please test Linux platform

@jrose-apple
Copy link
Contributor

Maybe they were StringRefs at one point.

@rintaro
Copy link
Member Author

rintaro commented May 9, 2019

Clang repo change has been merged to stable now.

Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Rintaro!

@compnerd
Copy link
Member

Seems that the tests here may be flakey on Windows.

@jrose-apple
Copy link
Contributor

Yikes. Got any more info for us?

@plotfi
Copy link
Contributor

plotfi commented Jul 17, 2019

Seems that the tests here may be flakey on Windows.

@compnerd
I also see some windows fails with one of the windows tests:

https://ci-external.swift.org/job/swift-PR-windows/28/console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants