Commit Graph

689 Commits

Author SHA1 Message Date
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Slava Pestov
2c6b9f71b6 AST: Change TypeAliasDecls to store an interface type as their underlying type
- TypeAliasDecl::getAliasType() is gone. Now, getDeclaredInterfaceType()
  always returns the NameAliasType.

- NameAliasTypes now always desugar to the underlying type as an
  interface type.

- The NameAliasType of a generic type alias no longer desugars to an
  UnboundGenericType; call TypeAliasDecl::getUnboundGenericType() if you
  want that.

- The "lazy mapTypeOutOfContext()" hack for deserialized TypeAliasDecls
  is gone.

- The process of constructing a synthesized TypeAliasDecl is much simpler
  now; instead of calling computeType(), setInterfaceType() and then
  setting the recursive properties in the right order, just call
  setUnderlyingType(), passing it either an interface type or a
  contextual type.

  In particular, many places weren't setting the recursive properties,
  such as the ClangImporter and deserialization. This meant that queries
  such as hasArchetype() or hasTypeParameter() would return incorrect
  results on NameAliasTypes, which caused various subtle problems.

- Finally, add some more tests for generic typealiases, most of which
  fail because they're still pretty broken.
2016-12-15 22:46:15 -08:00
Erik Eckstein
7208b18410 Mangling: support the new mangling prefix in various prefix checks 2016-12-15 14:08:11 -08:00
Bob Wilson
deddf19aae Merge remote-tracking branch 'origin/master' into master-next 2016-12-13 10:23:03 -08:00
practicalswift
76f0fdd670 [gardening] NULL → nullptr 2016-12-09 23:17:54 +01:00
Erik Eckstein
11d8207d0e Mangling: Select the correct mangling scheme for the re-mangler in the compiler 2016-12-09 09:05:15 -08:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
Doug Gregor
bcde6567d5 [AST] Introduce DeclContext::mapType(Into|OutOf)Context()
Use them to eliminate some more instances of getSelfTypeInContext().
2016-12-02 15:31:04 -08:00
Alex Blewitt
7159f6af1d Enable sourcekitd to be built by default on Linux
The Linux build has a dependency on the libdispatch library,
which is needed by the various native libraries for sourcekitd.

On macOS, the dependency for libdispatch is satisfied directly through
the base OS, but on Linux no such dependency exists.

Modify this so that if the SourceKit library is built, and the
libdispatch library is already present, then we shell out to make
the libdispatch binary project when the SourceKit is built.

Issue: SR-1676
2016-12-01 10:54:36 +00:00
Alex Blewitt
8531c5d190 Fix build errors for SourceKit on Linux (#5862)
The sourcekitd-repl, sourcekitd-test and complete-test use symbols
from both the coverage and lto modules, specifically
`llvm::coverage::CoverageFilenamesSectionWriter::write` and
`llvm::lto::thinBackend`. Adding these to the list of dependencies
allows SourceKit to be built on Linux.

Issue: SR-3223
2016-11-30 10:14:07 -08:00
Slava Pestov
7b59e75d34 IDE: hasType() => hasInterfaceType() 2016-11-29 03:05:31 -07:00
Rintaro Ishizaki
264be984b5 [AST] Eliminate NamedTypeRepr
Now that, TupleTypeRepr holds all information needed.
2016-11-26 14:17:57 +09:00
Jiang Jiang
8fc75457c3 [SourceKit] Fix a warning in SwiftSourceDocInfo.cpp
tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp:1042:13: warning: unused variable 'CompIns' [-Wunused-variable]
      auto &CompIns = AstUnit->getCompilerInstance();
            ^
1 warning generated.

Introduced by 5e8d8da380.
2016-11-24 18:29:18 -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
Slava Pestov
0c95a3bd1d AST: Correctly set PrintAST::CurrentType
When printing a nested type, make sure we call getMemberSubstitutions()
with the correct DeclContext.
2016-11-19 22:53:53 -08:00
Slava Pestov
2e901cb4f9 AST: Clean up PrintOptions a bit 2016-11-19 22:53:53 -08:00
Bob Wilson
f10ae47b9f Merge remote-tracking branch 'origin/master' into master-next 2016-11-15 17:32:28 -08:00
Xi Ge
5e8d8da380 [Test] Add range-info test driver to swift-ide-test. NFC 2016-11-15 13:48:15 -08:00
swift-ci
beaf946d27 Merge pull request #5645 from Aghassi/sourcekit-docs-complete.open 2016-11-13 22:24:39 -08:00
David Aghassi
da6111117e Fixed wording around codecomplete def 2016-11-11 09:37:50 -05:00
Doug Gregor
84d70a2284 Eliminate witness markers. NFC 2016-11-09 19:22:51 -08:00
Ben Langmuir
c8f53ff8c4 [index] Disable typo-correction when indexing
The errors won't be captured in the response, and it can be expensive to
do typo-correction when there are many errors, which is common in
indexing.

rdar://problem/28963058
2016-11-09 10:53:26 -08:00
David Aghassi
a2ffcfbbda Swapped wrong definitions and corrected minor mistakes
-  key.codecomplete.options, not key.options
-  Moved codecomplete definition to codecomplete.open
and vice versa
2016-11-08 20:31:26 -05:00
David Aghassi
29bf6a5ed0 Reformatted documentation based on benlangmuir recs 2016-11-08 08:24:18 -05:00
Xi Ge
5838e03726 [SourceKit] Add a SourceKitd test argument -pos-end.
Manually specifying range length is laborious and error-prone; this
commit adds an argument -end-pos=Line:Column to specify the end
position of a given range under test.
2016-11-07 18:08:18 -08:00
Xi Ge
d6f8f142a7 [SourceKit] Teach range-info request to recognize single declaration and multi-statements. (#5672) 2016-11-07 16:54:48 -08:00
David Aghassi
a1d77ee3f8 [SourceKit] Added completion.open-result docs 2016-11-04 21:50:26 -04:00
David Aghassi
4eced39f4b [SourceKit] Adds documentation for complete.open 2016-11-04 21:06:33 -04:00
Xi Ge
ac3411234d [SourceKit] The initial implementation of range-info request.
Like cursor-info, range info (""source.request.cursorinfo"") answers some
questions clients have for a code snippet under selection, for instance, the type of a selected
expression. This commit implements this new quest kind and provides two
simple information about the selected code: (1) the kind of the
snippet, currently limited to single-statement and expression; and (2)
the type of the selected expression. Gradually, we will enrich the
response to provide more insight into the selected code snippet.
2016-11-03 16:07:04 -07:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Bob Wilson
564fc6f22d Clean up my changes for llvm r284966.
Sorry -- I meant to include this with the previous commit. LLVM is
moving away from llvm::sys:TimeValue in favor of std::chrono. For consistency
with LLVM, I used the new llvm::sys::TimePoint type in most places.
There are a few places, like the SourceKit files modified here, where it
makes more sense to use std::chrono directly.
2016-10-28 13:17:26 -07:00
Bob Wilson
5c4f517824 Checkpoint fixes for llvm r284966 (TimeValue) 2016-10-28 12:09:57 -07:00
Bob Wilson
b227f45b7e Merge remote-tracking branch 'origin/master' into master-next 2016-10-27 22:28:28 -07:00
swift-ci
7a3a1e3697 Merge pull request #5500 from nkcsgexi/closure 2016-10-27 13:43:11 -07:00
Xi Ge
9577d980b0 [SourceKit] Initialize pointer as nullptr to fix a crash. rdar://28959889 2016-10-27 13:01:50 -07:00
Saleem Abdulrasool
228c4d5102 SourceKit: adapt for SVN r284681
LLVM SVN r284681 replaced `LLVM_FUNCTION_NAME` with `__func__` as all supported
compilers support that keyword now.  The holdout was MSVC, and swift requires
clang, so this is always supported.  NFC.
2016-10-26 15:27:52 -07:00
Ben Langmuir
d0581eaef3 Merge pull request #5479 from benlangmuir/compact-doc-struct
[sourcekit] Introduce a lazy representation for DocumentStructure responses
2016-10-26 12:58:39 -07:00
Ben Langmuir
178641d527 [sourcekit] Introduce a lazy representation for DocumentStructure responses
Previously, document structure responses were created using XPC
dictionaries, but this forced deserialization of the large nested
dictionaries no matter what the access pattern was.  The new format uses
our custom buffer machinery, and only deserializes dictionaries that are
actually needed.

The performance improvement is around 25% for an editor.open, and 35-40%
for an editor.replacetext request in the large files I've tested. The
performance improvements are in serialization (inside the service),
deserialization (client), and disposal of the response object (client).

rdar://problem/28789756
2016-10-26 10:16:58 -07:00
Xi Ge
7bd01b5ad1 [SourceKit] Never try to report mangled names for archetypes without contexts. rdar://28094209 2016-10-24 16:56:32 -07:00
Xi Ge
e01f0ac8b9 [SourceKit][DocInfo] For enum element decls, inherit their parent enum decls' deprecated attributes, if there are any. rdar:// 28802301 2016-10-21 12:49:59 -07:00
Doug Coleman
e03265877c [cmake] Make sure SOURCEKIT_DEPLOYMENT_OS is only set once, at the top.
Reset Darwin specific CMake variables to match the correct
SDK and architecture. This is needed when cross compiling, or we'll end up with
conflicting SDK and architectures.

Remove unused variable SOURCEKIT_GLOBAL_DEPLOYMENT_TARGET_FLAGS.
2016-10-18 13:40:04 -07:00
Xi Ge
0443a4dc46 [SourceKit] for cursor-info request, printing underlying types instead of namelias type. rdar://28216890 (#5339) 2016-10-17 22:18:59 -07:00
Bob Wilson
3fd92f82e8 Use StringRef in more places to match recent llvm changes.
llvm r283043 and possibly other recent changes switch to use StringRef
instead of char* pointers. Update Swift to match. In some cases, this is
a clear improvement. It would be good to assess the impact on memory use,
particularly for the Filename component of source locations.

Note that the change to SILLocation::isNull fixes an apparent bug where
the location was treated as null when the filename was *not* null.
2016-10-15 11:02:07 -07:00
Slava Pestov
cfe9e6a3de IDE: Use GenericSignatures and interface types (mostly)
There was a ton of complicated logic here to work around
two problems:

- Same-type constraints were not represented properly in
  RequirementReprs, requiring us to store them in strong form
  and parse them out when printing type interfaces.

- The TypeBase::getAllGenericArgs() method did not do the
  right thing for members of protocols and protocol extensions,
  and so instead of simple calls to Type::subst(), we had
  an elaborate 'ArchetypeTransformer' abstraction repeated
  in two places.

Rewrite this code to use GenericSignatures and
GenericFunctionType instead of old-school GenericParamLists
and PolymorphicFunctionType.

This changes the code completion and AST printer output
slightly. A few of the changes are actually fixes for cases
where the old code didn't handle substitutions properly.
A few others are subjective, for example a generic parameter
list of the form <T : Proto> now prints as <T where T : Proto>.

We can add heuristics to make the output whatever we want
here; the important thing is that now we're using modern
abstractions.
2016-10-02 23:49:15 -04:00
Michael Gottesman
e338c45964 [lto][cmake] When building with lto on macOS, specify to the linker the path where it should put the generated LTO object file.
This is important so that the object file references in the debug info are
preserved for possible use by dsymutil.

rdar://28062659
2016-09-24 22:38:33 -07:00
practicalswift
8d6251de66 [gardening] Fix accidental uses of \t 2016-09-17 13:15:26 +02:00
practicalswift
3a4ee89034 [gardening] Use consistent formatting. 2016-09-17 12:12:49 +02:00
practicalswift
7c63623ffc [gardening] Fix 13 recently introduced typos. 2016-09-16 20:30:57 +02:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Ben Langmuir
5ef19576a7 Merge pull request #4313 from rintaro/cc-attribute-colon
[Code Completion] Suffix ": " instead of "=" when completing attribute argument names
2016-08-16 13:38:38 -07:00