Commit Graph

228 Commits

Author SHA1 Message Date
Xi Ge
69cf097db8 sourcekitd/test: add an interface grouping test for user module. 2019-02-14 13:44:17 -08:00
Nathan Hawes
d164c616b4 [ParseableInterface][sourcekitd] Set the DetailedPreprocessorRecord ClangImporter option on the sub invocation if it's set on the parent
In addition to capturing more detailed preprocessor info, the
DetailedPreprocessorRecord option sets the clang module format to 'raw'
rather than the default 'object'. Sourcekitd doesn't link the code
generation libs, which it looks like the default 'object' format requires,
so it sets this option to true. The subinvocation generated when loading a
module from a .swiftinterface file still used the default prior to this
change though, so it would end up crashing sourcekitd.

This change sets the DetailedProccessorRecord option if the DetailedRecord
option is set on the preprocessor options of parent context's clang module
loader. This fixes interface generation crashing for modules that only have
a .swiftinterface file.

rdar://problem/43906499
2019-02-13 14:13:25 -08:00
Brent Royal-Gordon
7a3ed15846 Exclude/fix certain tests for swift-evolve (#21276)
* Add swift_evolve feature and disable several tests

This change adds a swift_evolve feature to our lit configuration and uses it to mark several tests as unsupported by swift_evolve.

One of these—test/api-digester/stability-stdlib-abi.swift—is actually pretty bad; we would really like to have it. But the digester has known issues exposed by swift-evolve.

* Remove order dependency in another test

* Tweaks from Jordan’s review

* Distinguish between tests which are intentionally unsupported and temporarily disabled.
* Add an explanation for one unsupproted test.
* Code nitpick.
2018-12-13 14:26:47 -08:00
Slava Pestov
6903e716fd Sema: Diagnose unsupported existential types in more places
Fixes <rdar://problem/23427259>, <https://bugs.swift.org/browse/SR-4207>.
2018-11-16 01:18:18 -05:00
Xi Ge
87ed4b4488 [test] Remove Swift 3 flags from various tests. 2018-10-09 16:09:41 -07:00
Mike Ash
5f17b450c3 [Stdlib] Make all the functions in LibcShims.h either INTERNAL or inline. Move LibcShimsInline.h to LibcOverlayShims.h for more consistent naming. Fix up several tests that needed the mock Darwin overlay built. Fix one SourceKit test that no longer produces is_system: 1 on an import Darwin line. 2018-10-03 09:55:34 -04:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Slava Pestov
c51f884879 SourceKit: Just always call getFormalAccess() 2018-09-05 16:51:20 -07:00
Jordan Rose
5a8cbe4503 [AST] Never print access levels on protocol requirements
We might allow this at some point in the future, but for now we should
stick to the syntax that people write in source.

rdar://problem/26746605
2018-08-16 16:00:49 -07:00
Doug Gregor
a66df57aaf [Mangling] Update SILGen and IRGen tests for mangling change. 2018-06-19 23:24:38 -07:00
John McCall
69f4dd1ec9 Generalize accessor storage to preserve the original accessor list.
Only not NFC because it's detectable by source tools.
2018-06-16 18:16:31 -04:00
Erik Little
863f3a19ff Rename @effects to @_effects
@effects is too low a level, and not meant for general usage outside
the standard library. Therefore it deserves to be underscored like
other such attributes.
2018-06-06 12:53:03 -04:00
Rintaro Ishizaki
b3453c17fe [ClangImporter] Take isCompatibilityAlias() into account in interface printing (#16625)
If the Clang declrations are *types*, canonical declaration in Swift is
imported for newest version of Swift. In interface generation, if the
declaration is versioned and it's imported as a member in either or both
version of Swift, we have to take compatibility typealias into account.

* Fixed 'ClangModuleUnit::getTopLevelDecls' to take isCompatibilityAlias() into account
* Fixed bugs in ClangImporter where member-to-member versioned types aren't properly imported.
  * Fixed 'SwiftDeclConverter::importFullName' to check equality of getEffectiveContext()
  * Fixed 'importer::addEntryToLookupTable' to check equality of getEffectiveContext()
    (moved 'ClangImporter::Implementation::forEachDistinctName' to 'NameImporter')
2018-05-22 13:38:45 +09:00
Argyrios Kyrtzidis
455e87bd96 [SourceKit] For the swift header interface request, accept the swift version as a string
This is so we can pass the version as "4.2".

rdar://38673625
2018-03-22 16:32:24 -07:00
Ben Langmuir
368e25ec05 [sourcekit] Fix tests that depend on accepting frontend arguments
These tests were relying on sourcekitd parsing as frontend instead of
using the driver.  Update them now to avoid churn when we fix command
line argument parsing in sourcekit.

The changes from clang-importer-sdk to clang-importer-sdk-nosource -I %t
are because clang-importer-sdk implies using -enable-source-import.
Rather than hack them up to use -Xfrontend, it is cleaner to just stop
using source import at all for these tests.  Incidentally, this improved
fidelity in a few places.  When using the generated swift modules we
also need to pass a target triple to sourcekit, which exposed some tests
that had mac-specific data.  This is a systemic issue for sourcekit
tests, but for now just make those few specific tests that we had
problems with run only on mac.
2018-02-05 10:09:03 -08:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Argyrios Kyrtzidis
9093dd7528 [test/SourceKit] Re-enable and update tests after recent stdlib changes
rdar://35799113
2017-12-05 10:23:14 -08:00
Ben Cohen
1924a3afa0 failing tests 2017-12-01 11:48:34 -08:00
Doug Gregor
a11c83d6bc Merge pull request #12394 from DougGregor/mangle-constrained-extension-conservative
[Mangling] Shrink mangling of constrained extensions conservatively
2017-10-11 23:10:52 -07:00
Marcelo Fabri
ba39c7b235 [SourceKit] Include AccessLevel attributes in structure (SR-5978) (#12086) 2017-10-11 20:57:09 -07:00
Doug Gregor
6e6b6b9837 [Mangler] Only mangle new requirements for constrained extensions.
Rather than mangling the complete generic signature of a constrained
extension, only mangle the requirements not already satisfied by the
nominal type. For example, given:

    extension Dictionary where Value: Equatable {
      // OLD: _T0s10DictionaryV2t3s8HashableRzs9EquatableR_r0_lE3baryyF
      // NEW: _T0s10DictionaryV2t3s9EquatableR_rlE3baryyF
      public func bar() { }
   }

In the existing mangling, we mangle the `Key: Hashable` requirement that’s
part of the generic signature. With this change, we only mangle the new
requirement (`Value: Equatable`).

This is a win for constrained extensions *except* in the case of a
constrained extension of a nominal type with a single, unconstrained
generic parameter:

    extension Array where Element: Equatable {
      // OLD: _T0Sa2t3s9EquatableRzlE3baryyF
      // NEW would be: _T0Sa2t3s9EquatableRzrlE3baryyF
      public func bar() { }
    }

Check explicily for this shortcut mangling and fall back to the old
path, so this change is a strict improvement.
2017-10-11 19:23:58 -07:00
Doug Gregor
ea1396c364 [GSB] Only build potential archetypes for associated type "anchors".
Use the "override" information in associated type declarations to provide
AST-level access to the associated type "anchor", i.e., the canonical
associated type that will be used in generic signatures, mangling,
etc.

In the Generic Signature Builder, only build potential archetypes for
associated types that are anchors, which reduces the number of
potential archetypes we build when type-checking the standard library
by 14% and type-checking time for the standard library by 16%.

There's a minor regression here in some generic signatures that were
accidentally getting (correct) same-type constraints. There were
existing bugs in this area already (Huon found some of them), while
will be addressed as a follow-up.

Fies SR-5726, where we were failing to type-check due to missed
associated type constraints.
2017-10-07 21:52:40 -07:00
Doug Gregor
797df6e8d7 Eliminate the _*Indexable protocols.
The various _*Indexable protocols only exist to work around the lack of
recursive protocol constraints. Eliminate all of the *_Indexable protocols,
collapsing their requirements into the corresponding Collection protocol
(e.g., _MutableIndexable —> Collection).

This introduces a number of extraneous requirements into the various
Collection protocols to work around bugs in associated type
inference. Specifically, to work around the lack of "global" inference
of associated type witnesses. These hacks were implicitly present in
the *Indexable protocols; I've made marked them as ABI FIXMEs here so
we can remove them when associated type inference improves.

Fixes rdar://problem/21935030 and a number of ABI FIXMEs in the library.
2017-10-01 15:08:23 -07:00
Marcelo Fabri
2bf49b0151 [SourceKit] Add range for attributes in a structure (SR-5587) (#11750) 2017-09-20 15:54:42 -07:00
Slava Pestov
696694b61d Update some IDE tests 2017-09-14 01:15:31 -07:00
Xi Ge
34e2aec662 Parser: use parser to generate a refined token stream to help syntax coloring. (#11809)
This patch allows Parser to generate a refined token stream to satisfy tooling's need. For syntax coloring, token stream from lexer is insufficient because (1) we have contextual keywords like get and set; (2) we may allow keywords to be used as argument labels and names; and (3) we need to split tokens like "==<". In this patch, these refinements are directly fulfilled through parsing without additional heuristics. The refined token vector is optionally saved in SourceFile instance.
2017-09-08 10:28:19 -07:00
Marcelo Fabri
c639147f02 [SourceKit] Include function return type in function kinds structure (SR-5613) 2017-08-14 20:53:00 +02:00
Arnold Schwaighofer
f442dd93bd CompilerInvocation: If no optimization flag is set default to Onone
I noticed in a follow-up patch that if you just swiftc without passing Onone
these flags are not set and sometimes happen to default to right thing ... or
not; as can be seen by the test cases modified. For example, at Onone we are
supposed to include an extra swift module "SwiftOnoneSupport".
2017-08-04 11:49:16 -07:00
swift-ci
747f79ca3b Merge remote-tracking branch 'origin/master' into master-next 2017-08-02 13:49:09 -07:00
Marcelo Fabri
d16cce3a94 [SourceKit] Add documentation range in structure (SR-2487) (#11264) 2017-08-02 13:39:49 -07:00
Jordan Rose
7efdfb4167 [ClangImporter] Fix macros defined in terms of other macros.
...which didn't do the right thing in the presence of ModuleMacro,
depending on the order the macros were referenced. Already covered by
test/ClangImporter/macros.swift, but it actually seems to improve the
behavior of some of the SourceKit tests as well.

Continuing rdar://problem/32199805, which is just "get macros working
with clang::ModuleMacro".
2017-07-26 15:42:31 -07:00
John Fairhurst
1f94eca80c [SourceKit] Add typealias to doc structure (#11143)
From https://bugs.swift.org/browse/SR-4828
2017-07-26 09:59:06 -07:00
Nathan Hawes
ecfa9ebfca [interface-gen] Rename AreSwiftArgs -> UsingSwiftArgs throughout 2017-07-13 15:37:17 -07:00
Nathan Hawes
3de0ea7e1b [interface-gen] Support passing Swift compiler arguments for header file interface generation
Resolves rdar://problem/33249361.
2017-07-13 14:21:06 -07:00
Dave Abrahams
9159239995 Un-revert "[stdlib] String index interchange, etc." (#10812)
I failed to merge the upstream changes to swift-corelibs-foundation at the same
time as I merged that #9806, and it broke on linux. Going to get it right this
time.
2017-07-07 12:13:25 -07:00
Xi Ge
d9fb110674 Revert "[stdlib] String index interchange, etc." (#10812)
rdar://33186295
2017-07-07 12:03:16 -07:00
Dave Abrahams
b1d2f4c68e [stdlib] String index interchange, part III (UTF8) 2017-07-07 06:15:24 -07:00
Dave Abrahams
2e0bb2f533 [stdlib] String index interchange, part II (UTF16) 2017-07-07 06:15:23 -07:00
Robert Widmann
6509f78f13 tests: replace remaining 'mkdir -p' calls with %empty-directory(...)'
These changes were made manually.
2017-06-04 11:08:39 -07:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Argyrios Kyrtzidis
5bb4f6ef46 [test] Simplify 'test/SourceKit/InterfaceGen/gen_header.swift' to check for the swift 4 change without duplicating the test file 2017-05-04 16:58:22 -07:00
Argyrios Kyrtzidis
896c4645df [SourceKit] Accept swift_version in requests and use to set the swift version for interface generation of an ObjC header
rdar://31432960
2017-05-04 16:53:00 -07:00
Slava Pestov
b5721e8d8e AST: Remove AnyObject protocol 2017-05-02 19:45:00 -07:00
Doug Gregor
29a15ce402 [Stdlib] Apply SE-0142 to fix ABI FIXME #92, part of ABI FIXME #99. 2017-04-19 23:15:33 -07:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Erik Eckstein
761d6512fe SourceKit: switch to new mangling in ide::printDeclTypeUSR
This was still missing.
2017-03-16 19:57:16 -07:00
Max Moiseev
ff81681f4f Properly naming bit count properties 2017-03-13 11:50:02 -07:00
Max Moiseev
835b8809d2 Merge branch 'master' into new-integer-protocols 2017-03-07 16:18:54 -08:00
Erik Eckstein
7995d3d35a SourceKit: Use new mangling for USR generation. 2017-02-23 12:47:10 -08:00
Nathan Hawes
dbf99dc862 Remove disabled SourceKit/InterfaceGen/gen_objc.swift test
It still fails and has been disabled ever since it was added.
rdar://problem/26484753
2017-02-13 10:10:22 -08:00