Commit Graph

117 Commits

Author SHA1 Message Date
Ben Barham
8889daedce [SourceKit] Add whether a property is dynamic
Properties can also be specified in a protocol/overridden by subclasses,
so they should also be classed as "dynamic" in these cases.

Removed receiver USRs when *not* dynamic, since it's not used for
anything in that case and should be equivalent to the container anyway.

Resolves rdar://92882348.
2022-05-13 15:13:49 -07:00
Alsey Coleman Miller
b85e673a78 [stdlib] Added Armv5 support 2022-03-06 00:56:32 -05:00
Ben Barham
ba868eaf1e Merge pull request #41395 from bnbarham/init-compiler-invocation-use-action
[IDE] Use the passed in Action for setting up an invocation
2022-02-16 12:23:51 -08:00
Ben Barham
e811c028f1 [IDE] Use the passed in Action for setting up an invocation
There was a recent change to error early if the stdlib couldn't be
loaded when semantic functionality is required. Since
`ide::initCompilerInvocation` was ignoring the given `Action` and just
setting to `Typecheck` instead, this would cause an error even if
semantic functionality *wasn't* required.

Resolves rdar://88968608.
2022-02-15 18:06:37 -08:00
Anthony Latsis
91bd2b1803 AST: Remove OpenedArchetypeType::getOpenedExistentialType()
Clients can explicitly ask for the opened existential type on the archetype's generic environment,
or use `getExistentialType` to obtain a specific archetype's upper bounds.
2022-02-04 16:22:50 +03:00
Alex Hoppen
22f67e89a6 [SourceKit] Explicitly specify frontend action type when creating compiler invocation
Explicitly specify the frontend action to make sure we aren’t loading thes stdlib if the performed action is syntactic only.
2021-12-13 15:32:08 +01:00
Hamish Knight
78d8d09b99 [IDE] Adopt ArgumentList 2021-09-01 18:40:26 +01:00
Ben Barham
15c7ddd33f [IDE] Skip synthesized curry thunks and walk their unwrapped expression
SemaAnnotator was walking into an autoclosure and then manually running
`passReference` on the unwrapped expression without walking it. Since
its synthesized anyway, skip walking the autoclosure entirely and walk
the unwrapped expression instead.

Fix `swift::ide::isBeingCalled` to look through `IdentityExpr`s and
`swift::ide::getBase` also not unwrapping curry thunks.

Resolves rdar://81312849
2021-07-31 16:05:30 +10:00
Ben Barham
717a932a3f [Utils] Make sure to write the rewritten file in refactor-check-compiles
`ClangFileRewriterHelper` only outputs the rewritten buffer when it's
destroyed, but the consumers were never being freed. Cleanup the
lifetime management of the stream and consumers so that they're properly
destroyed.

Rename `DuplicatingSourceEditConsumer` to
`BroadcastingSourceEditConsumer` to better describe its purpose.
2021-06-03 21:11:00 +10:00
jiaren wang
68eb0d7087 [Refactoring] generate both '-dump-text' and dump-rewritten from a single swift-refactor invocation (SR-14587) 2021-05-27 16:29:59 +08:00
Alex Hoppen
44f8e195ef [SourceKit] Recover if compiler arguments have errors
If the compiler arguments have errors in them (e.g. because a file with the same name is used twice), we can often still fulfill SourceKit requests because the compiler argument errors are only relevant for later stages of the compilation process.

Instead of bailing out early, do a best effor retrieving the compiler arguments that are valid and ignoring the errors.

Fixes rdar://77618144
2021-05-19 22:31:15 +02:00
Ben Barham
73d9f5b843 [SourceKit] Remove OptimizeForIDE global configuration
Have SourceKit return locations for symbols outside of the current
module as well. Callsites of location and comment information should
explicitly disable retrieving serialized information where performance
is a concern.

Resolves rdar://75582627
2021-05-01 11:37:23 +10:00
Ben Barham
19f23130d0 [SourceKit/CursorInfo] Mark dynamic calls
Adds two new fields to the cursor info response:
  1. is_dynamic: whether a call is dynamic
  2. receivers: receivers of the call (USRs)

Users of the CursorInfo request can use "is_dynamic" to decide whether
to lookup overrides or not, and then the "receivers" as the starting
point of the lookup.

Resolves rdar://75385900
2021-03-20 13:57:01 +10:00
Ben Barham
b889b0777d [IDE] Refactor some call related functions out of Index.cpp
The cursor info request also needs to output whether a call is "dynamic"
or not, move the functions related to this out of Index.cpp and into
IDE/Utils.cpp.

Also cleanup the `TrailingExpr` handling in `CursorInfoResolver` - it
only needs the first expression.
2021-03-20 13:57:01 +10:00
Varun Gandhi
caf1a55eea Merge pull request #35229 from mininny/switch-find-to-contains
[NFC] Replace uses of find(x) != end() idiom with contains(x) for StringRef and Set-like types
2021-02-08 13:57:43 -08:00
Varun Gandhi
0d1e7abc9a Merge pull request #35757 from cypherean/refactor_transform
Replace std::transform with llvm::transform
2021-02-05 08:17:48 -08:00
shreyaa-sharmaa
2b11d7acc7 Task SR-14138 Replace std::transform with llvm::transform 2021-02-04 12:58:33 +05:30
Minhyuk Kim
e924cf6104 Replace usages of StringRef.find(Key) != StringRef::npos to StringRef.contains(Key) 2021-02-04 00:42:04 +09:00
Ben Barham
a9073b0922 [Refactoring] Add async refactorings
Adds three refactorings intended to help users migrate their existing
code to use the new async language features:
  1. Convert call to use async alternative
  2. Convert function to async
  3. Add async alternative function

A function is considered to have an async alternative if it has a void
return type and has a void returning closure as its last parameter. A
method to explicitly mark functions as having an async alternative may
be added to make this more accurate in the future (required for eg.
a warning about a call to the non-async version of a function in an
async context).

(1) converts a call to use the new `await` async language syntax. If the
async alternative throws, it will also add `try`. The closure itself is
hoisted out of the call, see the comments on
`AsyncConversionStringBuilder` for specifics.

(2) converts a whole function to `async`, using (1) to convert any calls
in the function to their async alternatives. (3) is similar to (2), but
instead *adds* a function and replaces calls to its
completion/handler/callback closure parameter with `return` or `throws`.

Resolves rdar://68254700
2021-02-03 15:54:46 +10:00
Ben Barham
83915ccc4a [IDE] Add swift-refactor option to output as plain text
Current modes are:
  1. output the whole rewritten buffer, with RUN and CHECK lines removed
  2. output each replacement in JSON

To make each refactoring (rather than the whole file) easier to test,
add a plain text output option that can be easily checked with
FileCheck.
2021-02-03 15:54:46 +10:00
Rintaro Ishizaki
bf5d22257a [Frontend] Opt-in missing file recovery 2020-12-04 15:23:43 -08:00
Robert Widmann
a8766cce5b [NFC] Refactor InputFile's Accessors 2020-09-11 22:28:58 -06:00
Xi Ge
028a75572c ModuleInterface: remark potential version differences between SDK and prebuilt modules
Prebuilt-module directory now contains a SystemVersion.plist file copied from the SDK
it's built from. This patch teaches the compiler to remark this version and the SDK version
when -Rmodule-interface-rebuild is specified. The difference between these versions could
help us debug unusable prebuilt modules.
2020-09-04 11:45:05 -07:00
swift_jenkins
725692fd07 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-25 15:46:37 -07:00
Ben Langmuir
81786104f3 Move adjustClangTriple above its only caller 2020-08-25 11:16:53 -07:00
Ben Langmuir
af78895c45 [gardening] Sink compiler invocation code into libIDE 2020-08-25 10:39:37 -07:00
Karoy Lorentey
57ea964f2c Merge commit '3eb82c183662945687f48e11c09828f551b34858' into master-next
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:58:37 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
Karoy Lorentey
1c9b0908e6 Merge remote-tracking branch 'origin/master-next'
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:43:40 -07:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
Michael Forster
345a9147ec Explicit SmallString->std::string conversion.
This is only needed temporarily until commit d7049213 from upstream
LLVM hits the swift/master branch.
2020-03-13 19:16:49 +01:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Ben Langmuir
332729aeee Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/ClangImporter/ImportDecl.cpp
	lib/IDE/Utils.cpp
2020-03-12 16:41:32 -07:00
Adrian Prantl
41f76322d2 Adapt to upstream header file reshuffling 2020-03-12 10:23:47 -07:00
Shoaib Meenai
b6301c256c Include TargetInfo.h explicitly
https://github.com/llvm/llvm-project/commit/d7c5037e6b9f removes
implicit transitive includes of TargetInfo.h, so we must include it
explicitly where it's needed.
2020-03-11 23:36:59 -07:00
swift_jenkins
7c64387ae5 Merge remote-tracking branch 'origin/master' into master-next 2020-02-27 06:19:36 -08:00
Slava Pestov
783ea28f1a AST: Change AutoClosureExpr::isThunk() to getThunkType() 2020-02-26 23:09:54 -05:00
Robert Widmann
86ea1912c4 Merge remote-tracking branch 'upstream/master' into HEAD 2020-02-11 23:03:59 -08:00
Fred Riss
a3afd8b155 Adapt to llvm.org StringRef API change 2020-01-31 15:36:19 -08:00
Slava Pestov
3604b21f2a AST: Simplify Expr::getReferencedDecl() 2019-12-19 23:51:53 -05:00
Argyrios Kyrtzidis
4f07dcbb76 [lib/IDE] Improve error message outputted from getPlistEntry function. NFC 2019-10-02 13:54:49 -07:00
Slava Pestov
99ea1bb980 ClangImporter: Sink getEffectiveClangNode() down from IDE to the importer and clean up related code 2019-09-06 16:03:51 -04:00
Slava Pestov
be84556b9e ClangImporter: Record the error wrapper's struct 'Code' member enum in a side table 2019-09-03 22:53:52 -04:00
Argyrios Kyrtzidis
66be4a58b4 [Parser] Introduce ParserUnit::parse() function to avoid duplication of code 2018-12-16 09:52:15 -08:00
Bob Wilson
3347d482e9 NFC: Simplify code by using Triple.getOSAndEnvironmentName
This avoids the need to check if the environment component is set.
2018-12-12 11:30:58 -08:00
Saleem Abdulrasool
7f6a333c16 IDE: preserve the environment in the triple
Adjust the triple manipulation to preserve the environment.  This is
particularly important for android which is an environment for Linux,
and Windows, where we support specific environments only.
2018-12-04 19:50:39 -08:00
Xi Ge
3f58f1e6d3 swift-module-digester: add a flag to include Swift decls specifically.
This flag allows us to diagnose the overlay part exclusively without digesting
the entire SDK framework.
2018-10-09 12:57:22 -07:00
Xi Ge
24b0eac9a4 Parser: parse members in extension decls incrementally. 2018-09-05 17:00:39 -07:00
Jordan Rose
63cd1258ea Stop using SourceManager::getBufferIdentifierForLoc to find buffer IDs
The right way is findBufferContainingLoc. getBufferIdentifierForLoc is
both slower and wrong in the presence of #sourceLocation.

I couldn't come up with a test for the change in IDE/Utils.cpp because
refactoring still seems to be broken around #sourceLocation. I'll file
bugs for that.
2018-08-29 11:46:41 -07:00
Huon Wilson
d4f49a1252 [IDE] std::function -> llvm::function_ref for some non-escaping params. 2018-05-01 08:29:06 +10:00