Commit Graph

51 Commits

Author SHA1 Message Date
Arnold Schwaighofer
b5a5d38756 Adjust to LLVM's llvm_execute_on_thread removal 2021-08-05 12:15:23 -07:00
Saleem Abdulrasool
b1cd2bd26f SourceKit: add a newline to logged messages
Add a trailing newline to log messages in SourceKit to ensure that
messages are not merged with surrounding messages.
2021-05-24 13:32:28 -07:00
Minhyuk Kim
e924cf6104 Replace usages of StringRef.find(Key) != StringRef::npos to StringRef.contains(Key) 2021-02-04 00:42:04 +09:00
Ben Langmuir
6480bfaad2 [gardening] Move FuzzyStringMatcher to libIDE 2020-08-25 10:39:08 -07:00
Ben Langmuir
8e352b8006 [sourcekitd] Fix range shifting "race" with a fast semantic update
If a semantic update finishes fast enough, the token snapshot may be
identical to the edit snapshot, but because of getBufferForSnapshot
consolidating edits into a new buffer, we were not detecting that case
properly, and it could cause an assertion failure (or potentially
incorrect range shifting in a release build). This would have reproduced
very rarely in practice, but I can reproduce it by putting `sleep(2)`
calls right before we read the semantic info in open and edit requests.

Incidentally, fix sourcekit-test and unit tests for the (rare) case
where an open or edit already has updated semantic info.
2020-07-22 17:50:08 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Saleem Abdulrasool
1d5947b3bd build: remove SWIFT_NEEDS_EXPLICIT_LIBDISPATCH
Restore the previous commit which somehow passed the buildbot given a
missing condition on the sub-configure for libdispatch.  This makes it
more explicit as to what the desire is; the variable was being used to
serve as a proxy for whether the build is not on a Darwin target.
2019-11-20 08:27:30 -08:00
David Zarzycki
475f7c1e63 Revert "build: remove SWIFT_NEED_EXPLICIT_LIBDISPATCH (NFC)"
This reverts commit 18570c723f because it
breaks building on platforms that do not want or need libdispatch.
2019-11-20 08:14:03 +02:00
Saleem Abdulrasool
18570c723f build: remove SWIFT_NEED_EXPLICIT_LIBDISPATCH (NFC)
This flag was being used as an alias for whether or not the host is
non-Darwin.  Rather than adding custom checks for this, use the explicit
check that CMake supports.  This simplifies the logic and avoids the
proliferation of custom variables which can become confusing for others
who are not familiar with the custom build infrastructure.
2019-11-19 08:24:53 -08:00
Saleem Abdulrasool
717c4d3ebf SourceKit: remove LINK_LIBS (NFC)
This removes the custom `LINK_LIBS` in favour of
`target_link_libraries`.  This simplifies the custom functions that we
have for adding libraries, makes it easier to query the information from
ninja and will allow us to slowly remove more of the custom logic for
building the products.
2019-11-14 13:41:01 -08:00
Saleem Abdulrasool
ff601ad06d SourceKit: inline single-use variable (NFC)
Inline the unnecessary use of the variable for creating the
SourceKitSupport library.
2019-11-14 09:39:15 -08:00
Argyrios Kyrtzidis
92377cc145 [CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library 2018-12-05 22:41:39 -08:00
Saleem Abdulrasool
e7bc37b748 SourceKit: explicitly link against BlocksRuntime as well
On Darwin platforms, libdispatch and libBlocksRuntime are re-exported from
libSystem (via LC_REEXPORT_DYLIB).  Other platforms do not have libdispatch and
libBlocksRuntime in their C runtime, so we need to explicitly link against them.
Now that we are building BlocksRuntime with hidden visibility, we do not
accidentally get the symbols from libdispatch.
2018-10-03 13:36:18 -07:00
Rintaro Ishizaki
399fece7f5 [SourceKit] Dedicated error message for 'offset' + 'length' out of range 2018-08-02 09:29:28 +09:00
Rintaro Ishizaki
930d4342cd [SourceKit] Defensive guard for invalid offset and length in edit request
Otherwise, hits assertion, or crashes in no-assertion build.

Added 'EditableTextBuffer::getSize()' for getting size after previous updates
without actually applying them.

rdar://problem/34206143
2018-08-01 20:02:15 +09:00
Ben Langmuir
b78987a8c5 [sourcekit] Add diagnostics to compile notification callback
Compilations can now pass captured diagnostics as part of the
did-compile notification, and this was added to the SwiftASTManager.

rdar://38438512
2018-03-30 16:07:51 -07:00
Ben Langmuir
79d641d89b [sourcekit] Add optional compile notifications
When enabled, send a notification before/after every "compilation",
which for now means `performSema`. This piggy-backs and modifies some
existing code that we had for "tracing" operations in sourcekitd that
unfortunately was untested.  At least now some of the basic parts are
tested via the new notifications.

Part of rdar://38438512
2018-03-29 14:59:30 -07:00
Nathan Hawes
17a6ef5c6e Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager
SourceKit doesn't use them and if any unrecognised LLVM options are
passed to llvm::cl::ParseCommandLineOptions() it calls exit(), bringing
down SourceKit.

Also use fprintf instead of llvm::errs() in Logging.cpp as it uses a
global C++ object that had already been destructed when logging the
above failure.

Resolves rdar://problem/38314383
2018-03-09 18:56:57 -08:00
swift-ci
36b254df94 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 01:58:15 -08:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
Bob Wilson
e614f1b4d4 master-next: attempt to fix Linux bots
After my PR 13591 to adjust for LLVM r321257, the Linux bots are failing with
errors about missing conversions. For some reason that I don't understand,
those errors do not reproduce when I build locally on macOS. I think this
change should fix them. I also cleaned up some const_casts that should now
be unnecessary when using WritableMemoryBuffer.
2017-12-21 20:14:17 -08:00
Bob Wilson
a214a4df9d master-next: use WritableMemoryBuffer::getNewUninitMemBuffer
llvm r321257 removed MemoryBuffer::getNewUninitMemBuffer. Change to use
WritableMemoryBuffer::getNewUninitMemBuffer instead.
2017-12-21 17:21:05 -08:00
Rintaro Ishizaki
08ef4e324f [CMake] Add swift-syntax-generated-headers to the global dependencies 2017-12-05 17:03:12 +09:00
Ben Langmuir
c58cc4ee39 [sourcekitd] Fix a race in EditableTextBuffer::getSnapshot()
Found by TSan!

This was found while trying to reproduce a test failure on a linux bot
while running the test/Misc/stats.swift test.  Hopefully this was the
underlying issue.

rdar://35537968
2017-11-16 14:39:31 -08:00
Harlan
4ff07077bc Rename DEPENDS to LINK_LIBS throughout SourceKit (#11228)
Currently, SourceKit's CMake functions all use DEPENDS to specify
libraries the targets will link with. This is confusing as it doesn't
behave the same way that add_swift behaves, and implies that
dependencies are created when there aren't.
2017-08-01 21:25:19 -07:00
Harlan Haskins
dc4bc169a5 Make SourceKitSupport depend on swift-syntax-generated-headers 2017-08-01 09:17:35 -07:00
Harlan
a5098e6b69 Generate libSyntax API (#10926)
* Generate libSyntax API

This patch removes the hand-rolled libSyntax API and replaces it with an
API that's entirely automatically generated. This means the API is
guaranteed to be internally stylistically and functionally consistent.
2017-07-25 18:19:58 -07:00
practicalswift
797c2d8118 [gardening] Fix end of namespace comments 2017-04-20 22:01:01 +02:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Bob Wilson
5c4f517824 Checkpoint fixes for llvm r284966 (TimeValue) 2016-10-28 12:09:57 -07:00
Brian Croom
d1d7525497 [SourceKit] Rename Concurrency-Mac.cpp to Concurrency-libdispatch.cpp
This file builds fine as long as libdispatch is available, even on
non-Darwin platforms.
2016-07-18 16:17:49 -07:00
Brian Croom
e109cb8285 [SourceKit] Add libdispatch as a dependency for some SourceKit products
sourcekitdInProc, sourcekitd-test, and complete-test need to be explicitly
linked with libdispatch on Linux to build properly.
2016-07-18 16:17:49 -07:00
Brian Croom
479584109c [SourceKit] Add Semaphore to SourceKitSupport's concurrency module
Includes a libdispatch-based implementation.
2016-06-21 13:54:41 -04:00
Brian Gesiak
7cd74279f1 [SourceKit] Register optional sources in CMake
LLVM's CMake modules include a function `llvm_process_sources()`,
which (among other things) verifies that all source files in a
directory are either included in the list of source files to process,
or are included in a list `LLVM_OPTIONAL_SOURCES`.

SourceKit's CMake functions make use of this LLVM function, but do
not register any files as "optional". When attempting to configure
CMake to include SourceKit on a Linux host machine, source files
that are only included on Darwin host machines cause this function
to raise an error.

Mark Darwin-only SourceKit files as "optional" to avoid the error.
2016-05-10 16:36:35 -04:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Ben Langmuir
6581eba8e6 [CodeCompletion] Improve ordering of prefix matches vs popular names
In the experimental code-completion path.

rdar://problem/24843463
2016-03-09 11:23:06 -08:00
practicalswift
71e00fefa1 [gardening] Fix typos: "word word" (two spaces) → "word word" (one space) 2016-01-24 21:27:16 +01:00
Dmitri Gribenko
cbd87f84c9 Fix CMake coding style 2016-01-11 16:23:54 -08:00
practicalswift
c48a25647d Use correct formatting for separator line. 2016-01-05 09:49:00 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Arsen Gasparyan
ac6ec63a7a [compile error] a typo in source code 2015-12-28 15:27:00 +03:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
practicalswift
36d7072013 Remove immediately adjacent repeated words ("the the", "for for", "an an", etc.). 2015-12-21 22:16:04 +01:00
GauravDS
3315f592e8 Fix typos copnsumers => consumers 2015-12-12 23:57:12 +05:30
Ben Langmuir
7b0784958f [CodeCompletion] Penalize fuzzy matches that aren't on token boundaries even more
rdar://problem/22419553
2015-11-06 20:01:53 -08:00
Argyrios Kyrtzidis
d19e4ae026 [SourceKit] Add license notices to all the source files. 2015-11-05 12:01:14 -08:00