Commit Graph

1871 Commits

Author SHA1 Message Date
swift-ci
b0628c339a Merge remote-tracking branch 'origin/master' into master-next 2019-07-29 07:30:05 -07:00
Saleem Abdulrasool
370aa9d9c5 ClangImporter: search for glbc.modulemap in the SDK
When cross-compiling with a swift built for another target or when
building with a pure toolchain without the resource directory containing
host content, the modulemap required for Linux may not be found.  In
such a case, we should also look for the content in the SDK if one is
provided.  This improves the behaviour of `swiftc` for Linux with a
standalone SDK.
2019-07-27 21:48:07 -07:00
swift-ci
7f46a4a7fb Merge remote-tracking branch 'origin/master' into master-next 2019-07-22 16:10:11 -07:00
Jordan Rose
88405bc2f3 [ModuleInterface] Honor -disable-modules-validate-system-headers
The point of this flag is to avoid re-checking the whole SDK on every
build, since under many circumstances you can assume it hasn't
changed. That worked for Clang modules, but Swift cached modules also
end up with dependencies that shouldn't be updated.

rdar://problem/53279521
2019-07-18 18:38:31 -07:00
Jonas Devlieghere
94ef5431ff Merge Swift & Clang VFS in the ClangImporter
The clang importer has to deal with two virtual file systems, one coming
from clang, and one coming from swift. Currently, if both are set, we
emit a diagnostic that we'll pick the swift one.

This commit changes that, by merging the two virtual file systems. The
motivation for this change is the reproducer infrastructure in LLDB,
which adds a third virtual file system to the mix.
2019-07-18 16:29:08 -07:00
Joe Groff
d38a72c4ad Merge branch 'master' into master-next 2019-07-18 13:14:39 -07:00
Marc Rasi
8c993a3543 fix lldb test failure 2019-07-16 21:42:57 -07:00
Marc Rasi
840f4b90d9 some cleanup 2019-07-16 10:19:24 -07:00
Marc Rasi
a6e0210b6d thread a vfs through the completion handler 2019-07-16 10:19:24 -07:00
swift-ci
9894743d4f Merge remote-tracking branch 'origin/master' into master-next 2019-07-09 11:50:28 -07:00
Parker Schuh
fa69a73ee4 Add -enable-cxx-interop flag and support for extern "C" {} 2019-07-08 11:43:35 -07:00
Ben Langmuir
c42b732e26 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGenModule.cpp
2019-06-18 09:35:57 -07:00
Jordan Rose
2397bf4489 Under -enable-library-evolution, imports need Library Evolution too (#25549)
Otherwise, there's no guarantee of binary compatibility, and whoever
turned on library evolution support shouldn't be lulled into a false
sense of security.

This is just a warning for now, but will be promoted to an error later
once clients have shaken out any places where they're doing this.
Note that the still-experimental '@_implementationOnly' opts out of
this check, because that enforces that the import doesn't make its way
into the current module's public source or binary interface.

rdar://50261171
2019-06-18 09:22:56 -07:00
swift-ci
eb40386bbb Merge remote-tracking branch 'origin/master' into master-next 2019-06-12 17:51:09 -07:00
Jordan Rose
12e01d1ef6 [ClangImporter] Fix macOS app extension deprecated-as-unavailable check (#25399)
Fixes a typo introduced in 8b14600372 where a case was omitted from
the refactored version of a switch.

rdar://51417764
2019-06-12 17:43:31 -07:00
Davide Italiano
78dedd3259 [ClangImporter] size() for MemoryBlock is now allocatedSize(). 2019-05-21 13:24:22 -07:00
swift-ci
a23e1bc053 Merge remote-tracking branch 'origin/master' into master-next 2019-05-20 08:29:20 -07:00
Ben Langmuir
2210d24b48 [clang-importer] Fix option -disable-modules-validate-system-headers
This option stopped working when clang changed its default behaviour to
-fmodules-validate-system-headers; we now need to explicitly disable it
to preserve the behaviour of our flag.

rdar://problem/50908762
2019-05-17 16:22:37 -07:00
swift-ci
06402465ea Merge remote-tracking branch 'origin/master' into master-next 2019-05-09 16:29:03 -07:00
Rintaro Ishizaki
d3d30ee246 [Serialization] Support Swift only system module
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
2019-05-08 17:03:06 -07:00
swift-ci
e819dbf7ae Merge remote-tracking branch 'origin/master' into master-next 2019-05-08 14:09:14 -07:00
Rintaro Ishizaki
6956089b0b [CodeCompletion] Complete Swift only module name after 'import'
rdar://problem/39392446
2019-05-08 10:11:52 -07:00
swift-ci
33dcd2fa87 Merge remote-tracking branch 'origin/master' into master-next 2019-05-06 15:29:53 -07:00
Ben Langmuir
34da079aa6 Pass DynamicLookupInfo through VisibleDeclConsumers NFC
This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
2019-05-06 10:02:39 -07:00
swift-ci
599abafa17 Merge remote-tracking branch 'origin/master' into master-next 2019-05-03 11:30:29 -07:00
Jordan Rose
517f5d6b6a [ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between
"overlays", separate libraries that added Swift content to an existing
Objective-C framework, and "the Swift part of a mixed-source
framework", even though they're implemented in almost exactly the same
way. "Adapter module" was the term that covered both of those. In
practice, however, no one knew what "adapter" meant. Bring an end to
this confusion by just using "overlay" within the compiler even for
the mixed-source framework case.

No intended functionality change.
2019-05-03 11:11:58 -07:00
Bob Wilson
819e36ea40 Merge remote-tracking branch 'origin/master' into master-next 2019-03-30 15:10:05 -07:00
Jordan Rose
0ba6c495ba Add @_implementationOnly
This is an attribute that gets put on an import in library FooKit to
keep it from being a requirement to import FooKit. It's not checked at
all, meaning that in this form it is up to the author of FooKit to
make sure nothing in its API or ABI depends on the implementation-only
dependency. There's also no debugging support here (debugging FooKit
/should/ import the implementation-only dependency if it's present).

The goal is to get to a point where it /can/ be checked, i.e. FooKit
developers are prevented from writing code that would rely on FooKit's
implementation-only dependency being present when compiling clients of
FooKit. But right now it's not.

rdar://problem/48985979
2019-03-28 15:57:53 -07:00
Jordan Rose
9ed3fe061d Change ModuleDecl::getImportedModules to take an option set
...in preparation for me adding a third kind of import, making the
existing "All" kind a problem. NFC, except that I did rewrite the
ClangModuleUnit implementation of getImportedModules to be simpler!
2019-03-28 14:44:41 -07:00
Bob Wilson
26ae7f99b0 master-next: remove call to CompilerInstance::setVirtualFileSystem
Clang r357037 removed the VirtualFileSystem member of CompilerInstance,
using the VFS from the FileManager instead. Update Swift's ClangImporter
to match that change.
2019-03-27 12:32:48 -07:00
swift-ci
6a9f309a86 Merge remote-tracking branch 'origin/master' into master-next 2019-03-22 21:50:11 -07:00
Harlan Haskins
714a2b4044 Merge pull request #23173 from harlanhaskins/never-trust-the-system
[ParseableInterface] Serialize module into buffer and load from it
2019-03-22 21:37:49 -07:00
Harlan Haskins
5a29cdc118 [ClangImporter] Allow importing without a resource dir on non-Darwin
Previously, we would assert that there's a runtime resource dir
available, but then accept the possibility of no glibc.modulemap. We
should just do the same thing for 'no resource dir' as 'no module map'.
2019-03-22 17:29:11 -07:00
swift-ci
fb91371cf0 Merge remote-tracking branch 'origin/master' into master-next 2019-03-21 20:29:47 -07:00
Jordan Rose
61d3b0d4ec [ClangImporter] Avoid unneeded copy for getExportedModuleName
std::string -> StringRef of long-lived backing storage.

No functionality change.
2019-03-21 15:16:21 -07:00
swift-ci
6e69563f0c Merge remote-tracking branch 'origin/master' into master-next 2019-03-20 10:30:38 -07:00
Duncan P. N. Exon Smith
43e771e55b Reapply ClangImporter changes to leverage Clang's module cache
This reapplies four commits for the ClangImporter.  They broke the build
on master because the associated commits on swift-clang's
swift-5.1-branch never made it to stable due to automerger woes.  This
time I'll push everything through manually.

These are the commits being reapplied:

- a42bc62397 "ClangImporter: Share a module cache between CompilerInstances"
- 9eed34235b "ClangImporter: Adjust to r355777, PCMCache => ModuleCache"
- da8a1c57e8 "ClangImporter: Use the new CacheGeneratedPCH in Clang"
- 2134b17a20 "ClangImporter: Test that PCHs are actually cached in memory"

rdar://problem/48545366
2019-03-20 09:59:58 -07:00
swift-ci
07b27bc62c Merge remote-tracking branch 'origin/master' into master-next 2019-03-18 12:09:12 -07:00
Davide Italiano
8a015a54ff Revert "ClangImporter: Use the new CacheGeneratedPCH in Clang"
This reverts commit da8a1c57e8.
2019-03-18 11:30:43 -07:00
Davide Italiano
d3c699ae88 Revert "ClangImporter: Share a module cache between CompilerInstances"
This reverts commit a42bc62397.
2019-03-18 11:30:34 -07:00
Davide Italiano
c189561ff4 Revert "ClangImporter: Adjust to r355777, PCMCache => ModuleCache"
This reverts commit 9eed34235b.
2019-03-18 11:30:23 -07:00
Duncan P. N. Exon Smith
6eed1f9a39 Merge pull request #23248 from dexonsmith/PR-48740787.master
[master] Fix filesystem race in bridging PCH emission/loading
2019-03-18 09:31:03 -07:00
swift-ci
32dbf26869 Merge remote-tracking branch 'origin/master' into master-next 2019-03-14 17:50:28 -07:00
Brent Royal-Gordon
450aba71c0 Search for SwiftShims in SDK (#23287)
…but only if the compiler resource directory doesn’t have them. These will move to the SDK soon.
2019-03-14 17:34:58 -07:00
Duncan P. N. Exon Smith
da8a1c57e8 ClangImporter: Use the new CacheGeneratedPCH in Clang
This flag causes the generated PCH to be written into the in-memory
module cache.  Every CompilerInstance that tries to read the PCH will
use it rather than reading a potentially-since-overwritten version from
the filesystem.

rdar://problem/48740787
(cherry picked from commit 236fc19121)
2019-03-12 11:43:18 -07:00
Duncan P. N. Exon Smith
a42bc62397 ClangImporter: Share a module cache between CompilerInstances
Share an in-memory module cache between Clang compiler instances to
maintain a consistent view of the implicitly-generated PCMs, protecting
against filesystem races.  This cache is more robust after r355778.

Note that there are still potential races for PCHs; I'll fix that in a
follow-up.

rdar://problem/48545366
(cherry picked from commit bf0e9a70c6)
2019-03-12 11:43:18 -07:00
Duncan P. N. Exon Smith
9eed34235b ClangImporter: Adjust to r355777, PCMCache => ModuleCache
Upstream Clang renamed getPCMCache() to getModuleCache() in r355777,
stopped passing it the Preprocessor passing it directly to ASTReader
instead.  Adapt to those API changes.

rdar://problem/48545366
(cherry picked from commit 131cff72b2)
2019-03-12 11:43:17 -07:00
Duncan P. N. Exon Smith
236fc19121 ClangImporter: Use the new CacheGeneratedPCH in Clang
This flag causes the generated PCH to be written into the in-memory
module cache.  Every CompilerInstance that tries to read the PCH will
use it rather than reading a potentially-since-overwritten version from
the filesystem.

rdar://problem/48740787
2019-03-12 11:40:43 -07:00
Duncan P. N. Exon Smith
bf0e9a70c6 ClangImporter: Share a module cache between CompilerInstances
Share an in-memory module cache between Clang compiler instances to
maintain a consistent view of the implicitly-generated PCMs, protecting
against filesystem races.  This cache is more robust after r355778.

Note that there are still potential races for PCHs; I'll fix that in a
follow-up.

rdar://problem/48545366
2019-03-09 10:05:20 -08:00
Duncan P. N. Exon Smith
131cff72b2 ClangImporter: Adjust to r355777, PCMCache => ModuleCache
Upstream Clang renamed getPCMCache() to getModuleCache() in r355777,
stopped passing it the Preprocessor passing it directly to ASTReader
instead.  Adapt to those API changes.

rdar://problem/48545366
2019-03-09 09:57:01 -08:00