Commit Graph

19 Commits

Author SHA1 Message Date
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Becca Royal-Gordon
769ea4aa78 Share diagnoseAndRemoveAttr()
Merge together several helpers and code patterns for “diagnose/fix-it/invalidate bad attribute” into helper functions in TypeChecker.h.

This requires minor test changes in some places where we’re testing ObjC interop without importing Foundation; it’s otherwise NFC.
2021-05-21 16:10:11 -07:00
Nathan Hawes
0f8619b943 [IDE][SourceKit] Support escaped identifiers for the syntactic rename and related idents requests.
Resolves rdar://problem/46409010
Resolves rdar://problem/48256383
2020-04-30 13:08:23 -07:00
Ben Langmuir
0b93a247c6 [test] Remove now-redundant %mcp_opt from sourcekit tests
Remove `%mcp_opt` from commands that use `%sourcekitd-test` and
`%complete-test`, as they are now redundant with the lit substitution.
2020-01-22 11:12:25 -08:00
David Goldman
7b6f9499b7 Comment and sourcekitd-test fixes 2019-05-28 04:36:29 -04:00
David Goldman
1b1756cb55 Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-28 04:24:25 -04:00
David Goldman
176cd6cce1 Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-28 04:24:25 -04:00
Joe Groff
7d54810b92 Revert "[SourceKit] Fail requests when an error occurs" 2019-05-22 15:18:28 -07:00
David Goldman
1c819820fa Comment and sourcekitd-test fixes 2019-05-21 10:40:22 -04:00
David Goldman
a3a4d2d22b Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-03 11:01:22 -04:00
David Goldman
10ecea6269 [SourceKit] Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-03 11:01:21 -04:00
Xi Ge
243ec5ac86 Name translation: Allow type name translation when cursor points to constructor call. rdar://33163114 (#10872) 2017-07-11 12:46:52 -07:00
Ben Langmuir
c89d024cd2 [sourcekitd] When searching for a clang decl, look at overrides
Allows us to do name-transation on an override of a clang decl.

rdar://problem/32187817
2017-05-14 15:05:35 -07:00
Ben Langmuir
8aaf2d64ed [sourcekitd] Take the colons out of name-translation API
This makes us more lenient about what we accept for Objective-C
selectors by allowing you to include or not include the trailing colons.
We don't actually need that information, because we have access to the
declaration, so it was only being used for validation, which made the
API harder to use for clients that didn't carefully track zero vs
one-arg selector names.

Also remove the colons from the response, and instead add a bit to say
whether it is a zero-arg or one-arg selector.  This makes the response
easier to use for clients that don't care about this information, and
more consistent with the change to the input.

rdar://problem/32177934
2017-05-14 09:57:12 -07:00
Ben Langmuir
7e5dd1fa01 [sourcekitd] Allow mising name pieces preferred names
With the interpretation that they mean to retain whatever the name
piece was in the original name.
2017-04-25 15:25:53 -07:00
Xi Ge
2e447dc812 NameTranslation: ensure that preferred names are preferred to implicit names in @objc(). rdar://30658589 (#7692)
Implicit names in @objc() are essentially cached auto-translated Swift names. This patch ensures that we don't mistake them for explicitly specified objc selectors.
2017-02-22 14:48:19 -08:00
Xi Ge
143c5a5d82 Address @jrose-apple's code review comments (#7474) 2017-02-14 18:41:21 -08:00
Xi Ge
055da1fbfb [SourceKit] Teach name translation request to translate Swift names to ObjC ones (by using PrintAsObjC). (#7449) 2017-02-14 14:25:52 -08:00
Xi Ge
b32424953e [SourceKit] Add a new request to translate from Objc names to Swift names and vice versa.
Extensive cross-language tooling support needs to bridge decl names between two different languages more freely. This SourceKit request is designed to translate Objc names to Swift names and vice versa. Working similarly to cursor-info requisition, the name translation request requires a Swift reference to a Swift/Clang decl, and the preferred name to translate from, and language kind that the given name belongs to. If the translation succeeds, SourceKit service responds with the corresponding name than belongs to the other kind of language.

Newly introduced keys:

“key.namekind": “source.lang.name.kind.objc” | "source.lang.name.kind.swift"
“key.basename”: “name"
“key.argnames”: [“name"]
“key.selectorpieces”: [“name[:]"]

This commit only implements translation from Objc to Swift.
2017-02-10 17:50:12 -08:00