Commit Graph

17988 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
28b15852d8 Fix tests due to clang namespacing USR changes 2017-04-24 17:42:36 -07:00
swift-ci
03c125979b Merge pull request #8985 from nathawes/rdar31758709-cursor-info-crasher 2017-04-24 17:41:28 -07:00
Dave Abrahams
c2a92a695c Prototype stateful Unicode decoding
Having looked at the old transcoding code, it's very clear that no stateless
scheme has a hope of competing with it on performance.  We just need reverse
transcoding and a way to hook up indices (I believe we can use IndexingIterator
for this, that's coming).

This code demonstrates UTF-8 (the hard one) and is competitive on performance
with the existing code.  I believe it could be even better-performing if the
cases that do parsing were connected directly with the cases that do decoding.

Finally, tatoo this on your forehead: Dmitri Shall Not Be Underestimated
2017-04-24 17:31:42 -07:00
Nathan Hawes
6b58cd7d00 [test] Add regression test for cursor-info crasher in rdar://problem/31758709 2017-04-24 17:03:34 -07:00
Robert Widmann
4b45b49c58 Remove dependence on IDE tests 2017-04-24 19:43:02 -04:00
Argyrios Kyrtzidis
be12528bcc Merge pull request #8746 from felix91gr/master
Added -help option to sourcekitd-test
2017-04-24 16:06:47 -07:00
swift-ci
2f11ae3b37 Merge pull request #8977 from DougGregor/rethrow-single-arg-func 2017-04-24 15:44:25 -07:00
Huon Wilson
aaf69e5c86 Merge pull request #8966 from huonw/emit-loaded-module-trace
[test] rdar://problem/31771633 stop looking for target dependent libraries
2017-04-24 15:21:01 -07:00
Michael Ilseman
2d8164e552 [stdlib] Parse my tweets faster! 2x forwards, 3x reverse
Adds in a special case grapheme break detection between two values
within scalar ranges where we have special knowledge. Any sub-0x300
scalars, except CR-LF, are guaranteed to have grapheme breaks between
them. We're reasonably confident this will not change in future
versions of Unicode. We might add more ranges in the future, but
should do so conservatively, anticipating future Unicode changes.

In these cases we can very quickly break, even for strings that have
mixed latin and emoji characters. In a ASCII string with a single
emoji in it, we traverse the string 2x faster forwards and 3x faster
in reverse. (Reverse is 3x faster as it involves some forwards
traversal inside of the index). For a string that's half Latin half
non-Latin, we're about 1.5x faster forwards and backwards.
2017-04-24 15:17:25 -07:00
Doug Gregor
b07d9951e4 [Type checker] Handle 'rethrows' checks for single-parameter functions.
The throw-checking code wasn't properly coping with functions that
take a single, labeled argument, due to the longstanding lie that
pretends that functions take a tuple argument vs. zero or more
separate arguments. Here, the lie manifests as spurious "call can
throw, but is not marked as such" errors.

Fixes rdar://problem/31794932.
2017-04-24 14:48:54 -07:00
Argyrios Kyrtzidis
792d7c06a5 [test/SourceKit/DocSupport] Fix test for @objc USR change 2017-04-24 14:13:37 -07:00
Argyrios Kyrtzidis
093e826f92 [index] Use a #pragma to apply module namespacing for exported ObjC header and match Swift namespaced USRs with the clang side 2017-04-24 14:02:16 -07:00
Jordan Rose
f3f8b626d2 Merge pull request #8715 from jrose-apple/deserialization-recovery-for-inits
[Serialization] Drop overriding initializers with missing bases.
2017-04-24 13:58:05 -07:00
Xi Ge
2a2731a797 migrator: add a flag to print incoming usrs to the API diff data store to facilitate testing. NFC (#8969) 2017-04-24 13:53:55 -07:00
Roman Levenstein
53745e61cf Merge pull request #8961 from swiftix/open-archtypes-tracker-fixes
[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
2017-04-24 13:52:51 -07:00
swift-ci
971283096c Merge pull request #8968 from nkcsgexi/migrator-simple-rename 2017-04-24 13:05:33 -07:00
Xi Ge
5b86c72493 migrator: support simple variable renames. rda://31766131 2017-04-24 12:36:30 -07:00
Jordan Rose
abdaaefe29 [Serialization] Drop overriding initializers with missing bases.
This is the same as the last few commits, but with the additional
complication of designated initializers affecting other behavior
around the type. In particular, convenience initializers cannot be
invoked on subclasses if the designated initializers are not all
present on the subclass. If a designated initializer is dropped, it's
not possible to satisfy that.

It would be nice to do better here, since a class's initializers are
mostly independent of the superclass's initializers. Unfortunately, it
still affects whether /this/ class can inherit convenience
initializers, as well as vtable layout. This is conservative, at
least.
2017-04-24 11:53:54 -07:00
swift-ci
b0ff277c2a Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 11:48:41 -07:00
Jordan Rose
7397340ca8 Don't inherit convenience inits if a designated init is missing. (#8708)
(which can happen if an imported class has un-importable initializers)

Our initializer model guarantees that it's safe to inherit convenience
initializers when a subclass has implemented all designated
initializers, since each convenience initializer will be implemented
by calling one of the designated initializers. If one of the
designated initializers /can't/ be implemented in Swift, however,
then inheriting the convenience initializer would not be safe.

This is potentially a source-breaking change, so the importer will
only actually record that it failed to import something in when
compiling in Swift 4 mode.

rdar://problem/31563662
2017-04-24 11:47:54 -07:00
Huon Wilson
a4a8600f62 [test] rdar://problem/31771633 stop looking for target dependent libraries. 2017-04-24 11:28:26 -07:00
swift-ci
771cdb8a82 Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 11:08:52 -07:00
Jordan Rose
d123794829 Merge pull request #8849 from jrose-apple/error-structs-are-an-illusion
[ClangImporter] Error structs from enums are not imported decls
2017-04-24 10:52:19 -07:00
swift-ci
825553bfab Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 10:48:43 -07:00
Huon Wilson
d08d0ffdb8 Merge pull request #8845 from huonw/private-func-sig-specializations
[SILOpt] Specialized functions are never public.
2017-04-24 10:41:41 -07:00
Jordan Rose
e575d2d5ba [ClangImporter] Error structs from enums are not imported decls.
Enums with the ns_error_domain attribute represent codes for NSError,
which means Swift developers will expect to interact with them in
terms of Error. SE-0112 improved bridging for these enums to generate
a struct with the following form:

    struct MyError: Error {
      @objc enum Code: RawRepresentable {
        case outOfMemory
        case fileNotFound
      }
      var userInfo: [NSObject: AnyObject] { get }
      static var outOfMemory: Code { get }
      static var fileNotFound: Code { get }
    }

where MyError.Code corresponds to the original MyError enum defined in
Objective-C. Until recently, both the enum and the synthesized struct
were marked as having the original enum as their "Clang node", but
that leads to problems: the struct isn't really ObjC-compatible, and
the two decls have the same USR. (The latter had already been worked
around.)

This commit changes the struct to be merely considered a synthesized
"external definition", with no associated Clang node. This meant
auditing everywhere that's looking for a Clang node and seeing which
ones applied to external definitions in general.

There is one regression in quality here: the generated struct is no
longer printed as part of the Swift interface for a header file, since
it's not actually a decl with a corresponding Clang node. The previous
change to AST printing mitigates this a little by at least indicating
that the enum has become a nested "Code" type.
2017-04-24 09:57:41 -07:00
Jordan Rose
129fd372d5 ASTPrinter: Qualify names when printing nested declarations.
That is, if you have this declaration:

    struct Outer {
      struct Inner {
        // ...
      }
    }

and you're just printing 'Inner', print it like this:

    struct Outer.Inner {
      // ...
    }

This comes up with the ClangImporter's import-as-member feature, and
is also about to affect how error code enums are imported as well.

This is currently only enabled in certain contexts: always when
printing interfaces, and for types (but not other members) when
printing declarations for Quick Help.

rdar://problem/28208090
2017-04-24 09:57:40 -07:00
Jordan Rose
25985cb764 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2017-04-24 09:57:30 -07:00
swift-ci
95e7aff734 Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 09:48:41 -07:00
Alex Blewitt
71987b90b2 Merge pull request #8485 from norio-nomura/enable-sourcekit-test
Enable SourceKit tests if building SourceKit
2017-04-24 17:37:30 +01:00
swift-ci
70b8773fb5 Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 09:28:38 -07:00
swift-ci
cd262be2c6 Merge pull request #8955 from DougGregor/associated-type-override-hints 2017-04-24 09:11:38 -07:00
Roman Levenstein
202de40f05 [sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
Fixes rdar://problem/31749245
2017-04-24 08:50:55 -07:00
swift-ci
41d1fde57d Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 08:48:39 -07:00
Andrew Trick
588b578498 [Exclusivity] Update SILGen tests for static access markers. 2017-04-24 08:32:15 -07:00
Doug Gregor
de66b0c25c [GSB] Warn about redeclarations of associated types from inherited protocols.
Introduce a warning about redeclaring the associated types from an
inherited protocol in the protocol being checked:

* If the new declaration is an associated type, note that the
  declaration could be replaced by requirements in the protocol's
  where clause.
* If the new declaration is a typealias, note that it could be
  replaced by a same-type constraint in the protocol's where clause.
2017-04-24 07:55:42 -07:00
swift-ci
e3d8c83201 Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 00:48:43 -07:00
John McCall
0d4e0a961d Fix the writeback-conflict diagnostic to look through access markers.
We're now double-diagnosing some things that are caught by both
SILGen and static enforcement; we can fix that later, but I want to
unblock this problem first.
2017-04-24 02:02:47 -04:00
swift-ci
2101e287a4 Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 20:08:33 -07:00
Maxim Moiseev
1c1b2b966d [stdlib] String : RangeReplaceableCollection & BidirectionalCollection (#8921)
* [stdlib] String : RangeReplaceableCollection & BidirectionalCollection

* Add source compatibility hack for Swift.max

* Add source compatibility hack for Swift.min

* Remove redundant conformance in benchmarks

* Fix stupid typo I thought I'd already pushed

* XFAIL testing now-redundant conformance

* XFAIL an IDE test for now
2017-04-23 20:04:54 -07:00
swift-ci
a88e174fe6 Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 13:48:30 -07:00
Devin Coughlin
112c3c65c0 [TSan/Exclusivity] Make test more robust against optimization
Add a "black hole" uninstrumented function to the test that prevents the
compiler from removing an unused read that needs to be instrumented by
TSan for the test to pass.

This is needed to prevent the optimizer from removing a useless read
when static enforcement of exclusivity is turned on.
2017-04-23 13:03:53 -07:00
swift-ci
bbc8725ee6 Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 12:28:32 -07:00
Devin Coughlin
9cdff5fe00 [Exclusivity] Improve static enforcement diagnostics
Static diagnostics now refer to the identifier for the variable requiring
exclusive diagnostics. Additionally, when two accesses conflict we now always
emit the main diagnostic on the first modifying access and the note on either
the second modifying access or the read.

The diagnostics also now highlight the source range for the expression
beginning the access.
2017-04-23 11:39:25 -07:00
swift-ci
1560c052a7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 05:48:31 -07:00
Arnold Schwaighofer
304b6c9a0e Merge pull request #8943 from aschwaighofer/loop_unroller_sge_bound
LoopUnroller: Teach the loop unroller about >= terminated loops
2017-04-23 05:35:52 -07:00
swift-ci
f833100078 Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 03:08:29 -07:00
swift-ci
0bcb6b816c Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 02:28:30 -07:00
Slava Pestov
683a7f49e4 SILOptimizer: Fix spurious 'unreachable code' warning when a failable initializer calls a never-returning function
This came up recently with the protocol-oriented integer
work in the standard library.

Fixes <https://bugs.swift.org/browse/SR-4673>.
2017-04-23 02:15:57 -07:00
Slava Pestov
c89ebec356 AST: Fix ProtocolConformanceRef::subst() with self-conforming existentials 2017-04-23 01:49:01 -07:00