Commit Graph

1938 Commits

Author SHA1 Message Date
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Andrew Trick
f071cf133a Revert "[basic] Add a simple vector backed 2 stage multi map." 2020-01-07 16:05:21 -08:00
Michael Gottesman
14defc5cca Merge pull request #29035 from gottesmm/pr-ebb0dcee0c191285561b19c13b8d192fba6aa6f2
[basic] Add a simple vector backed 2 stage multi map.
2020-01-06 23:32:45 -08:00
Michael Gottesman
96a0c7931d [basic] Add a simple vector backed 2 stage multi map.
I have been using this in a bunch of places in the compiler and rather than
implement it by hand over and over (and maybe messing up), this commit just
commits a correct implementation.

This data structure is a map backed by a vector like data structure. It has two
phases:

1. An insertion phase when the map is mutable and one inserts (key, value) pairs
into the map. These are just appeneded into the storage array.

2. A frozen stage when the map is immutable and one can now perform map queries
on the multimap.

The map transitions from the mutable, thawed phase to the immutable, frozen
phase by performing a stable_sort of its internal storage by only the key. Since
this is a stable_sort, we know that the relative insertion order of values is
preserved if their keys equal. Thus the sorting will have created contiguous
regions in the array of values, all mapped to the same key, that are insertion
order. Thus by finding the lower_bound for a given key, we are guaranteed to get
the first element in that continguous range. We can then do a forward search to
find the end of the region, allowing us to then return an ArrayRef to these
internal values.

The reason why I keep on finding myself using this is that this map enables one
to map a key to an array of values without needing to store small vectors in a
map or use heap allocated memory, all key, value pairs are stored inline (in
potentially a single SmallVector given that one is using SmallFrozenMultiMap).
2020-01-06 16:39:42 -08:00
Saleem Abdulrasool
040050a6c7 Basic: out-of-line equality operator (NFCI)
MSVC did not like the original code and would fail to build as:

  ```
  swift\include\swift/Basic/Located.h(50): error C2995: 'bool swift::operator ==(const swift::Located<T> &,const swift::Located<T> &)': function template has already been defined
  swift\include\swift/Basic/Located.h(50): note: see declaration of 'swift::operator =='
  llvm\include\llvm/Support/TrailingObjects.h(76): note: see reference to class template instantiation 'swift::Located<swift::Identifier>' being compiled
  llvm\include\llvm/Support/TrailingObjects.h(233): note: see reference to class template instantiation 'llvm::trailing_objects_internal::AlignmentCalcHelper<swift::Located<swift::Identifier>>' being compiled
  swift\include\swift/AST/Decl.h(1512): note: see reference to class template instantiation 'llvm::TrailingObjects<swift::ImportDecl,swift::Located<swift::Identifier>>' being compiled
  ```

The original code is odd.  There appears to be some unnecessary
complexity.

First, the member function is marked as a friend of a
`struct` type which does not change the member's visibility, thus all
the members are `public`, and the function need not be friended.

Second, the function is templated over the same parameter type, which
means that the original template parameter could be used and the
standard member equality operator could be used rather than the
free-standing form.

It is unclear why the member equality operator is insufficient, and the
extraneous template instatiations here seem wasteful.  Out-of-line the
free-standing form and not mark it as a friend to restore the build.
Switching to a member form can be a follow up change.
2020-01-06 15:53:19 -08:00
Varun Gandhi
022314a640 Merge pull request #28643 from kitaisreal/using-located-instead-of-pair
[Compiler]: Using Located<T> instead of std::pair<SourceLoc, T>
2020-01-06 14:22:29 -08:00
David Ungar
6fffe724f2 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-04 14:37:06 -08:00
swift_jenkins
81c0ed297a Merge remote-tracking branch 'origin/master' into master-next 2020-01-02 10:19:08 -08:00
Saleem Abdulrasool
01d5652999 remove VS2015 workaround (NFC)
VS2015 had an issue with the deletion of an operator.  Since VS2017 is
the minimum version that LLVM uses, we can assume that VS2017+ is in use
(_MSC_VER >= 1910).  Clean up the now defunct workaround.
2019-12-23 11:55:10 -08:00
Kita, Maksim
646e9ac77f SR-11889: Fixed code review issues 2019-12-22 14:42:47 +03:00
Kita, Maksim
a2cce2b293 SR-11889: Fixed code review issues 2019-12-20 17:19:00 +03:00
Kita, Maksim
c70bd2b2c9 SR-11889: Located added dump methods 2019-12-20 17:19:00 +03: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
5fdea64d7e SR-11889: Fixed code review issues. 2019-12-20 17:18:59 +03:00
Kita, Maksim
c88ac85b3f SR-11889: Fixed code review issues
1. Removed two braces {{ usage of Located initialization
2. Wrapped documentation into 80 characters
2019-12-20 17:18:59 +03:00
Kita, Maksim
c1444dea18 SR-11889: Fixed code review issues 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
swift_jenkins
f898b2bd5e Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 11:19:56 -08:00
Doug Gregor
393c6d35bf Merge pull request #28874 from DougGregor/unversioned-triple
[Driver] Add unversioned triple to the output of -print-target-info.
2019-12-19 11:07:02 -08:00
Doug Gregor
3a9b8bc658 [Driver] Add unversioned triple to the output of -print-target-info.
SwiftPM wants to use the unversioned triple to know where to put
results. Vend this as part of -print-target-info.
2019-12-19 09:10:58 -08:00
swift_jenkins
a812971ee5 Merge remote-tracking branch 'origin/master' into master-next 2019-12-17 15:00:16 -08:00
Xi Ge
9b599961d5 Merge pull request #28691 from nkcsgexi/tbdgen-ld-hide
TBDGen/IRGen: generate $ld$hide$os symbols for decls marked with @_originallyDefinedIn
2019-12-17 14:41:04 -08:00
swift_jenkins
c9d8f24ebf Merge remote-tracking branch 'origin/master' into master-next 2019-12-16 17:40:20 -08:00
Robert Widmann
e7170bd751 Add Qualified Lookup Requests 2019-12-16 15:36:09 -08:00
Xi Ge
03fab30ee0 Merge branch 'master' into tbdgen-ld-hide 2019-12-14 20:57:05 -08:00
Xi Ge
3a55c3c96e Front-end: teach the compiler to generate a .c file for $ld$add$os symbols.
When symbols are moved to this module, this module declares them as HIDE
for the OS versions prior to when the move happened. On the other hand, the
original module should declare ADD them for these OS versions. An executable
can choose the right library to link against depending on the deployment target.
This is a walk-around that linker directives cannot specify other install
name per symbol, we should eventually remove this.
2019-12-13 17:22:00 -08:00
swift_jenkins
234bd8784e Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 00:00:34 -08:00
Robert Widmann
acf282bc3d Merge pull request #28689 from hamishknight/lookup-requests
[NameLookup] Add requests for module and AnyObject lookup (master)
2019-12-10 23:54:51 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Daniel Duan
1ac34471e5 [NFC][Migrator] Make Diff.h private (#28637)
Gardening: `Migrator` is the reason Diff.h is here. Reduce its
visibility.
2019-12-08 15:44:48 -08:00
Brent Royal-Gordon
e1e7a3fe75 Merge pull request #25656 from brentdax/file-name-basis
Shorten #file and add #filePath (behind an experimental flag)
2019-12-06 21:34:58 -08:00
Daniel Duan
7485716d4b [Basic] Delete unused Varint (#28595)
(Gardening/NFC) As far as I can tell, this isn't used anywhere.
2019-12-05 16:35:19 -08:00
Brent Royal-Gordon
63ec1cf5af Introduce a separate #filePath, remove -pound-file
This makes the path behavior more first-class. The feature is now hidden behind an experimental flag, -enable-experimental-concise-pound-file.
2019-12-04 16:35:13 -08:00
Brent Royal-Gordon
44a2f67f4b Turn new #file behavior off by default 2019-12-04 16:33:25 -08:00
Brent Royal-Gordon
789d38eb04 Control #file behavior with a command line option 2019-12-04 16:33:25 -08:00
David Ungar
380d0d973e Merge pull request #28563 from davidungar/renaming-dependencies
[Incremental compilation] Rename "experimental dependencies" to "fine-grained dependencies"
2019-12-04 10:47:24 -08:00
David Ungar
6a6e9357ef Change "experimental" to "fine-grained". 2019-12-04 08:50:44 -08:00
Varun Gandhi
e7be41d0cb Merge pull request #27479 from varungandhi-apple/vg-track-clang-function-types
Track Clang function types in the AST
2019-12-04 08:47:35 -08:00
Saleem Abdulrasool
98dcc5ed25 Merge pull request #28457 from compnerd/basic-cleanup
cleanup LangOptions
2019-12-03 08:27:11 -08:00
Daniel Duan
ff4ecd2e5b [include] Use nullptr instead of NULL (#28509)
NFC, gardening.
2019-12-01 23:20:10 -08:00
Saleem Abdulrasool
851f877390 Basic: default platform version to 0.0.0
The platform versions are really only used on Darwin platforms.
Simplify the path by defaulting to `0.0.0` on all platforms, and
handling the version number on supported platforms.
2019-11-24 10:12:07 -08:00
Hamish Knight
6811586e40 Remove NumLookupQualifiedInAnyObject counter
We now have an equivalent counter for
AnyObjectLookupRequest.
2019-11-22 12:59:27 -08:00
Hamish Knight
2ca30c6847 Remove NumLookupInModule counter
We now have an equivalent counter for
LookupInModuleRequest.
2019-11-22 12:59:27 -08:00
Varun Gandhi
196f358dec [AST] Add ClangTypeConverter, computing C types for FunctionTypes.
Note: The change in ASTBuilder::createFunctionType is functionally minor,
but we need the FunctionType::Params computed _before_ the ExtInfo, so we
need to shuffle a bunch of code around.
2019-11-22 12:42:36 -08:00
David Ungar
62ae2bfd2f Merge pull request #28164 from davidungar/WIP-custom-diff
[Incremental compilation] Source-range-based dependencies
2019-11-21 23:47:52 -08:00
swift_jenkins
1c4a601114 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 18:40:09 -08:00
Dan Zheng
eaad4fc780 Mark IntRange::iterator::operator{==,!=} as const. (#28390)
`IntRange::iterator::operator==` must be marked as `const` in order to use
`OptionalTransformRange<IntRange<...>, ...>::empty` under specific conditions.
2019-11-20 18:24:38 -08:00
swift_jenkins
2a8c94a938 Merge remote-tracking branch 'origin/master' into master-next 2019-11-18 18:19:58 -08:00
Robert Widmann
a5d8f7fcd3 Merge pull request #28294 from hamishknight/disqualified
[NameLookup] Add UnqualifiedLookupRequest
2019-11-18 18:15:29 -08:00
swift_jenkins
3c0be18594 Merge remote-tracking branch 'origin/master' into master-next 2019-11-17 07:21:07 -08:00