Commit Graph

566 Commits

Author SHA1 Message Date
swift-ci
6567197d2d Merge remote-tracking branch 'origin/master' into master-next 2019-08-28 14:50:21 -07:00
David Ungar
1415f2f7f9 LazyASTScopes only matters when ASTScopes are enabled 2019-08-28 11:31:17 -07:00
Arnold Schwaighofer
02b908dca3 Merge remote-tracking branch 'origin/master' into master-next 2019-08-28 06:51:13 -07:00
Xi Ge
1e656662d9 Frontend: add a front-end option to specify module names for which we prefer to loading via interfaces
ABI checker imports Swift frameworks by using Swift interfaces for various
reasons. The existing way of controlling preferred importing mechanism is by
setting an environment variable (SWIFT_FORCE_MODULE_LOADING), which may lead
to performance issues because the stdlib could also be loaded in this way.

This patch adds a new front-end option to specify module names for
which we prefer to importing via Swift interface. The option currently is only
accessible via swift-api-digester.

rdar://54559888
2019-08-27 19:40:58 -07:00
swift-ci
05b8e03fc8 Merge remote-tracking branch 'origin/master' into master-next 2019-08-26 18:50:36 -07:00
David Ungar
5e14ed3f7d Merge pull request #26859 from davidungar/A-8-15-astscope-off
[NameLookup ASTScopes] Still off-by-default, but much closer to turning on
2019-08-26 18:32:30 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
Arnold Schwaighofer
2b41f8d8d5 Merge remote-tracking branch 'origin/master' into master-next 2019-08-26 08:57:42 -07:00
Slava Pestov
c45cb54168 Frontend: Remove unused CompilerInstance::getPrimarySourceFileOrMainModule() method 2019-08-23 22:13:34 -04:00
Jonas Devlieghere
b4d268e9e1 Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances in the swift repo.
2019-08-15 11:32:39 -07:00
Slava Pestov
39cf99c13b Frontend: PersistentParserState needs to outlive performSema()
We want SILGen and IRGen to also be able to trigger delayed parsing if
necessary, so tweak things here a bit. For now this is NFC, since name
lookup triggers delayed parsing of all types and extensions the first
time a name lookup is performed -- but that is about to change.
2019-08-12 17:15:51 -04:00
David Ungar
f9266b9670 Add method disableASTScopeLookup for lldb 2019-08-05 22:33:56 -07:00
Michael Gottesman
698f8dab0f [gardening] Add a pre-processor guard in header swift/Frontend/ParseableInterfaceModuleLoader.h
I also fixed a few style/doxygen errors.
2019-07-25 10:33:19 -07:00
Saleem Abdulrasool
38995f5d80 Merge pull request #25070 from moatom/fix-include-guard
Fix include guards
2019-06-20 17:26:08 -07:00
Harlan Haskins
57f517317d Rename flag to ‘module-interface-preserve-types-as-written’ 2019-06-13 11:26:54 -07:00
Harlan Haskins
889e43076f [ModuleInterface] Allow falling back to prefer TypeReprs
There are still cases (a module with a type that's the same name as the
module) where we cannot fully qualify all types. In those cases, allow
them to remain unqualified with a flag, `-Xfrontend
-preserve-types-as-written-in-module-interface`.
2019-06-13 11:26:54 -07:00
moatom
2e95a0d265 Fix include guards 2019-06-02 12:10:43 +09:00
Jordan Rose
0f45437104 -build-module-from-parseable-interface: Don't make an extra ASTContext (#25185)
This mode is supposed to get all its configuration information from
the switftinterface being read in, but that means that the ASTContext
and ClangImporter that get created by default may not be a sensible
configuration (for example, a mismatched target and SDK, which Clang
emits a warning about). Avoid this by just not creating the ASTContext
if it's already been determined that the frontend is building a module
from a parseable interface.
2019-06-01 15:27:17 -07:00
Jordan Rose
d44edf4dbd [ModuleInterface] Change swift-tools-version to swift-compiler-version (#25160)
swift-tools-version as used by SwiftPM is an actual, parsed field with
semantic meaning. swift-compiler-version as used when generating
module interfaces is just to record what version of the compiler
generated the interface. They shouldn't have the same name.
2019-05-30 19:23:45 -07:00
Harlan Haskins
5cb98bfe80 [ModuleInterface] Pass -Rmodule-interface-rebuild to sub-invocation (#24737)
Previously, we wouldn't pass this flag to sub-invocations, which means
that if we had to fall back and recompile a transitive import, we
wouldn't get a remark.

rdar://50729662
2019-05-13 12:56:18 -07:00
Rintaro Ishizaki
6956089b0b [CodeCompletion] Complete Swift only module name after 'import'
rdar://problem/39392446
2019-05-08 10:11:52 -07:00
Harlan Haskins
dfe4491702 [ModuleInterface] Emit remarks when rebuilding from an interface
Keep track of information that led the module interface loader to reject loading a compiled module, if it needed to fall back to compiling an interface.

rdar://47792754
2019-05-02 17:46:34 -07:00
Harlan Haskins
6f0d1378d3 [Frontend] Add -Rmodule-interface-rebuild
Passing this will turn on remarks if the module loader needed to fall back and compile a module from an interface.
2019-05-02 10:39:16 -07:00
Adrian Prantl
b244b0928e Factor out the pre-registered MemoryBuffer functionality
form SerializedModuleLoader into its own ModuleLoader class. (NFC-ish)

This gives better control over the order in which the various module
load mechanisms are applied.
2019-04-22 09:17:08 -07:00
Harlan Haskins
e5456984f7 [ModuleInterfaces] Remove 'parseable' from command-line flags
Leave the old flag in as an alias to the new flag, for transition
purposes. Also go ahead and remove the long-deprecated and unused
`emit-interface-path`.

Part of rdar://49359734
2019-04-11 18:05:09 -07:00
David Ungar
cf5d81c889 Merge pull request #23735 from davidungar/tracking-primary
[Batch mode] Cope with bugs that cause error  suppression.
2019-04-05 17:45:20 -07:00
David Ungar
44daa88ebd Format 2019-04-03 12:53:31 -07:00
David Ungar
9cc3a4a9d8 Rename defaultDiagnosticLoc to bufferIndirectlyCausingDiagnostic. 2019-04-03 12:52:49 -07:00
Nathan Hawes
58d622d796 [ParseableInterface] Don't serialize resource directory deps and stop adding cached modules to the dependency tracker
This patch modifies ParseableInterfaceBuilder::CollectDepsForSerialization to
avoid serializing dependencies from the runtime resource path into the
swiftmodules generated from .swiftinterface files. This means the module cache
should now be relocatable across machines.

It also modifies ParseableInterfaceModuleLoader to never add any dependencies
from the module cache and prebuilt cache to the dependency tracker (in addition
to the existing behaviour of not serializing them in the generated
swiftmodules). As a result, CollectDepsForSerialization no longer checks if the
dependencies it is given come from the cache as they are provided by the
dependency tracker. It now asserts that's the case instead.
2019-04-03 06:35:11 -07:00
Nathan Hawes
f683373116 [ParseableInterface] Respect -track-system-dependencies with -build-module-from-parseable-interface
Updates the subinvocation that builds the parseable interface to respect the
-track-system-dependencies flag of the top-level invocation if present, by
including system dependencies in the produced .swiftmodule.
2019-04-03 06:34:29 -07:00
David Ungar
c139c5909a Pass defaultDiagnosticLoc to handleDiagnostic, not currentPrimaryInput. 2019-04-02 22:27:55 -07:00
David Ungar
c90d9e69b6 Format 2019-04-02 00:43:59 -07:00
David Ungar
7a0e0ffc8a Store current primary in diagnostic engine, pass it down via handleDiagnostic. Unformmated. 2019-04-02 00:43:28 -07:00
Erik Eckstein
00599eeb3c Check for completeness of the SwiftOnoneSupport library
When compiling SwiftOnoneSupport, issue errors for missing functions which are expected in the module.
This ensures ABI compatibility.

rdar://problem/48924409
2019-03-25 14:57:03 -07:00
Harlan Haskins
9ef4b5f358 [ParseableInterface] Add test for writing modules to a buffer 2019-03-22 17:29:11 -07:00
Jordan Rose
22f9853b76 [ParseableInterface] Turn on -enable-parseable-module-interface always (#23331)
...and remove the option. This is ~technically~ CLI-breaking because
Swift 5 shipped this as a hidden driver option, but it wouldn't have
/done/ anything in Swift 5, so I think it's okay to remove.

Note that if a parseable interface (.swiftinterface) and a binary
interface (.swiftmodule) are both present, the binary one will still
be preferred. This just /allows/ parseable interfaces to be used.

rdar://problem/36885834
2019-03-16 15:31:11 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Brent Royal-Gordon
21b96d4840 Merge pull request #23175 from brentdax/theres-a-path-for-everyone
Look for runtime library modules in the SDK, too
2019-03-12 22:27:01 -07:00
Brent Royal-Gordon
46ddb2a607 [NFC] Support many runtime library import paths
Replaces SearchPathOptions::RuntimeLibraryImportPath with an equivalent std::vector of paths. Also reimplements SearchPathOptions::SkipRuntimeLibraryImportPaths to cause the list of runtime library import paths to be empty, rather than exiting early from SerializedModuleLoader::findModule().
2019-03-11 19:06:51 -07:00
Harlan Haskins
bef17468ae Merge pull request #22603 from harlanhaskins/where-do-i-stash-my-cache-hashes
[ParseableInterface] Flesh out parseable module loading
2019-03-10 16:10:09 -07:00
Harlan Haskins
366bbf48b9 [ParseableInterface] Add ‘forwarding modules’
A ‘forwarding module’ is a YAML file that’s meant to stand in for a .swiftmodule file and provide an up-to-date description of its dependencies, always using modification times.

When a ‘prebuilt module’ is first loaded, we verify that it’s up-to-date by hashing all of its dependencies. Since this is orders of magnitude slower than reading mtimes, we’ll install a `forwarding module` containing the mtimes of the now-validated dependencies.
2019-03-07 11:36:15 -08:00
Gwen Mittertreiner
8a6d28c7d0 Fix the Rest of the Windows Driver Tests 2019-03-06 14:23:49 -08:00
Harlan Haskins
67a447f15f [Frontend] Add flag to use hash-based dependencies
Since prebuilt modules are going to use hashes for their dependencies, we need a flag to turn that behavior on. By default, we use modification times.
2019-03-05 11:46:21 -08:00
Bob Wilson
06120c9d9d More fixes in recent Swift changes to work with newer VFS code. 2019-02-08 16:01:41 -08:00
Saleem Abdulrasool
adcdc39791 swift: update for LLVM SVN r344140
Update swift's usage of clang::vfs which has been hoisted into LLVM.
2019-02-07 17:53:42 -08:00
Harlan Haskins
17821b6fd7 [ParseableInterface] Remove some accidentally-committed code 2019-02-06 16:24:33 -08:00
Harlan Haskins
4eafcc9a6f [ParseableInterface] Use arch for cache key instead of full triple
The target triple actually includes too much information -- just use the
target architecture.

rdar://46503065
2019-02-05 15:44:39 -08:00
Slava Pestov
482f73c605 Frontend: Don't use separate delayed parsing callbacks for primary and non-primary files 2019-01-18 00:15:53 -05:00
Jordan Rose
c88c8b5f90 [ParseableInterface] Don't serialize deps for explicit builds
If the frontend is invoked with
-build-module-from-parseable-interface, we might be trying to persist
and distribute the swiftmodule that gets built. In that case, any
dependencies we list might not be relevant.

This probably isn't really the final answer here; what we want is some
way to say /which/ dependencies are relevant, and how they're related
to how the swiftmodule that gets used. Most likely the right answer
here is to limit this to dependencies within the SDK or something.
2018-12-21 15:41:23 -08:00
Jordan Rose
614deb640b [ParseableInterface] Pass prebuilt cache path down to sub-invocations
Otherwise, the top-level compilation gets the benefit of the prebuilt
cache path, but the sub-invocations for swiftinterfaces that /do/
need to be compiled do not.
2018-12-21 15:41:17 -08:00