Commit Graph

279 Commits

Author SHA1 Message Date
Xi Ge
3a214d99f6 Frontend: add an argument to disable implicitly built Swift modules 2020-06-02 16:51:45 -07:00
swift_jenkins
68af9d595b Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 20:18:30 -07:00
Xi Ge
38c0452d65 DependenciesScanner: report command-line arguments for building pcm explicitly 2020-05-22 07:50:08 -07:00
Erik Eckstein
82a006be26 Merge remote-tracking branch 'origin/master' into master-next 2020-05-16 10:26:27 +02:00
Xi Ge
7d08a24161 ModuleInterface: reconstruct command-line arguments for building Swift module from interface explicitly 2020-05-15 10:49:45 -07:00
Arnold Schwaighofer
622fee54a7 Another std::string StringRef assignment. 2020-05-13 07:35:11 -07:00
Xi Ge
3952fd5bf7 ModuleInterface: refactor compiler instance configuration to a standalone delegate class. NFC
Module interface builder used to maintain a separate compiler instance for
building Swift modules. The configuration of this compiler instance is also
useful for dependencies scanner because it needs to emit front-end compiler invocation
for building Swift modules explicitly.

This patch refactor the configuration out to a delegate class, and the
delegate class is also used by the dependency scanner.
2020-05-12 16:19:27 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Xi Ge
8c2a041822 Front-end: add an option to not lock interface file when building module
This could help fix a flaky test.

Related to: rdar://58578342
2020-02-25 12:13:14 -08:00
Alexis Laferrière
ffa0bda67e [Frontend] Use the private module interface when available 2020-02-19 14:17:14 -08:00
Brent Royal-Gordon
e4c1de675a [NFC-ish] Simplify module loader filename handling (#29295)
* Remove dead ModuleSourceInfoFilename parameters

These were never actually used; we might find a way to bring them back later.

* Introduce SerializedModuleBaseName

This is intended to replace the _n_ filename parameters that tend to get passed around in the SerializedModuleLoader classes.

* Manipulate currPath in SerializedModuleLoader less often

* Don’t pass raw paths around SerializedModuleLoader

Only pass base names.

* Regularize module file opening functions
2020-01-21 13:02:20 -08:00
Xi Ge
e1f6e846ca Re-apply "ModuleInterface: lock .swiftinterface while generating module cache" 2020-01-10 12:25:15 -08:00
Mishal Shah
c769e491e2 Revert "ModuleInterface: lock .swiftinterface while generating module cache" 2020-01-09 22:54:41 -08:00
Xi Ge
a8baeb3670 Merge pull request #29101 from nkcsgexi/lock-interface-gen-module
ModuleInterface: lock .swiftinterface while generating module cache
2020-01-09 17:41:20 -08:00
Xi Ge
8dda0193a6 ModuleInterface: lock .swiftinterface while generating module cache
This ensures only one process is generating module cache from an interface
file so that we don't blow up memory usage when multiple processes are
doing the same. The locking mechanism is similar to that of Clang's.

A better approach is that the build system takes care of the module building
step as a formal dependency.

rdar://52839445
2020-01-09 15:45:48 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
Varun Gandhi
68a68cb564 Merge pull request #27635 from varungandhi-apple/vg-robustify-module-trace-emission
Make module trace emission more robust.
2019-10-15 20:45:04 -07:00
Varun Gandhi
903add2c3f [Frontend] Make the module trace emission more robust.
✔ More informative error messages in case of crashes.
✔ Handling and documenting different cases.
✔ Test cases for different cases.
✔ Make SDKDependencies.swift pass again.
2019-10-15 15:44:26 -07:00
swift-ci
e85a715a62 Merge pull request #27634 from varungandhi-apple/vg-add-module-loader-ordering-doc 2019-10-14 17:06:04 -07:00
Varun Gandhi
d68866ca98 [NFC] Explain the order for adding module loaders. 2019-10-14 15:40:10 -07:00
Xi Ge
014f863546 SerializeLoc: address more comments from Jordan. NFC 2019-10-09 15:29:52 -07:00
Xi Ge
212fe43d79 SerializeLoc: ensure we can load serialized source locations when we are importing a module from a Swift interface file 2019-10-09 15:29:52 -07:00
Xi Ge
e9dfdea6fd SerializeLoc: serialize basic decl source location information to .swiftsourceinfo file
After setting up the .swiftsourceinfo file, this patch starts to actually serialize
and de-serialize source locations for declaration. The binary format of .swiftsourceinfo
currently contains these three records:

BasicDeclLocs: a hash table mapping from a USR ID to a list of basic source locations. The USR id
could be retrieved from the following DeclUSRs record using an actual decl USR. The basic source locations
include a file ID and the results from Decl::getLoc(), ValueDecl::getNameLoc(), Decl::getStartLoc() and Decl::getEndLoc().
The file ID could be used to retrieve the actual file name from the following SourceFilePaths record.
Each location is encoded as a line:column pair.

DeclUSRS: a hash table mapping from USR to a USR ID used by location records.

SourceFilePaths: a hash table mapping from a file ID to actual file name.

BasicDeclLocs should be sufficient for most diagnostic cases. If additional source locations
are needed, we could always add new source location records without breaking the backward compatibility.
When de-serializing the source location from a module-imported decl, we calculate its USR, retrieve the USR ID
from the DeclUSRS record, and use the USR ID to look up the basic location list in the BasicDeclLocs record.

For more details about .swiftsourceinfo file: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation
2019-10-09 15:29:51 -07:00
Jordan Rose
b32e82c720 More idiomatic use of llvm::hash_combine in many places (#27497)
- No need to hash input values first
- Pass many values to a single hash_combine to save on intermediates
- Use hash_combine_range instead of a loop of hash_combines

No functionality change.
2019-10-04 13:08:24 -07:00
Harlan Haskins
c0908160a6 [ModuleInterfaces] Combine the normalized target triple into the cache hash
Previously, we'd combine just the target architecture, and rely on the
fact that the .swiftinterface is in a reasonably-target-specific
subdirectory to include enough entropy to avoid hash collisions. But in
the presence of a VFS or if two targets are sharing the same
.swiftinterface file (which can sometimes happen in tests), they will
collide since the hash only includes architecture.

Instead, use the same normalization that the serialized module loader
uses, and serialize the normalized target triple instead.

Fixes rdar://55881335
2019-10-02 11:43:55 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
Harlan Haskins
dcbfe443ca [ModuleInterfaces] ParseableInterfaceBuilder -> ModuleInterfaceBuilder
Rename ParseableInterfaceBuilder to accompany ModuleInterfaceLoader
2019-09-13 13:52:16 -07:00
Harlan Haskins
fafc5832fe [ModuleInterfaces] ParseableInterfaceModuleLoader -> ModuleInterfaceLoader
Rename this class to better fit the user-facing name.
2019-09-13 13:40:01 -07:00