273 Commits

Author SHA1 Message Date
practicalswift
40cf4d183d [gardening] Use consistent spacing after if, for and while 2017-04-14 17:35:36 +02:00
Nathan Hawes
a57fd2a4b0 [indexer] Add an option to index local symbols too, and a new index::indexDeclContext() entry point
Resolves rdar://problem/31433002.
2017-04-12 09:04:03 -07:00
Xi Ge
936b4a25da Revert "Index: Expose the logic for deciding whether to index a symbol. NFC. (#8438)"
We currently don't need this logic elsewhere, thus it's good to give
indexer some privacy.
2017-04-01 10:39:36 -07:00
Xi Ge
9e6d584b60 Index: Expose the logic for deciding whether to index a symbol. NFC. (#8438) 2017-03-30 14:00:44 -07:00
Xi Ge
0ccbfdb933 Index: Record override-of relationship between a decl in protocol extension and the protocol requirements it can provide default implementations for. (#8418) 2017-03-29 19:39:39 -07:00
Xi Ge
1827fb1436 RangeInfo: Report RValue type if a decl reference is of read-only LValue type. (#8300) 2017-03-23 15:52:54 -07:00
Hugh Bellamy
7a704b2605 Fix MSVC control path warnings 2017-03-16 08:55:51 +07:00
Nathan Hawes
2c4bee9935 Merge pull request #8094 from nathawes/rdar31039915-index-local-params
[indexer] Index parameter definitions with a distinct external argument label too (but not their refs)
2017-03-14 17:44:25 -07:00
Nathan Hawes
7b75cf792c [indexer] Index parameter definitions with a distinct external argument label too (but not their refs)
Parameter defs with a separate external argument label are marked with the 'Local' symbol property.
This ensures the indexer has enough information for clients to match up a function's argument labels with its child parameter definitions.
Resolves rdar://problem/31039915.
2017-03-14 16:12:48 -07:00
Slava Pestov
162b2d252e AST: Include gardening to minimize dependencies on Expr.h
A lot of files transitively include Expr.h, because it was
included from SILInstruction.h, SILLocation.h and SILDeclRef.h.

However in reality most of these files don't do anything
with Exprs, especially not anything in IRGen or the SILOptimizer.

Now we're down to 171 files in the frontend which depend on
Expr.h, which is still a lot but much better than before.
2017-03-12 22:26:56 -07:00
Nathan Hawes
28719efd7a [indexer] Fix missing references to protocol properties
Only accessors uses were being reported previously. Resolves rdar://problem/30773201
2017-03-07 16:19:19 -08:00
Argyrios Kyrtzidis
2b9e102b75 [index] Move determination of SymbolProperty::UnitTest at index::getSymbolInfoForDecl()
Otherwise symbol info for relations of such methods does not contain this property.
2017-03-06 12:42:23 -08:00
Argyrios Kyrtzidis
c5456e38ed [index] Handle properly typealiases as inherited types
Report the typalias as reference and its underlying nominal type as an 'implicit' base relation.
2017-03-04 19:23:02 -08:00
Nathan Hawes
583f74017b [indexer] Add RelationContainedBy from references to their containing functions
Resolves rdar://problem/30765261
2017-02-28 16:55:18 -08:00
Nathan Hawes
2684564590 [indexer] report defs/refs of parameters without a separate external name 2017-02-28 11:55:34 -08:00
practicalswift
efb4183c8f [gardening] Remove unused variable NTD 2017-02-24 09:38:00 +01:00
Nathan Hawes
50113b74cf [indexer] Fix all function references being reported with the call role regardless of them actually being called or not 2017-02-22 13:37:32 -08:00
Argyrios Kyrtzidis
4b1d99fcc3 [index] Relate extension members with the extension symbol. 2017-02-19 20:10:33 -08:00
Argyrios Kyrtzidis
a13289835e [index] For extensions, relate the symbol reference that gets extended and base references with the extension symbol.
They were getting related with the original extended symbol, which was incorrect.
2017-02-19 18:19:39 -08:00
Argyrios Kyrtzidis
560bb99c02 [index] Provide distinct USRs for extension symbols
For indexing purposes we need to be able to treat extensions as distinct symbols.
rdar://30512293
2017-02-14 11:15:45 -08:00
Argyrios Kyrtzidis
459a5c604d [index] Make sure hasUsefulRoleInSystemModule() checks if 'any' of the listed SymbolRoles is present. 2017-02-06 08:48:02 -08:00
practicalswift
e2f8af7762 [gardening] Fix clang-tidy warnings 2017-02-04 09:23:10 +01:00
practicalswift
0193f2b872 [gardening] Fix typos 2017-02-04 09:22:38 +01:00
Xi Ge
6b699d8855 SourceEntityWalker: keep track of type reference in extension declarations' openings. (#7192)
This is necessary when we want to differentiate between type reference
on extension declaration's start, e.g "extension A {}", and other
references of "A". NFC on existing functionality.
2017-02-01 17:09:01 -08:00
Argyrios Kyrtzidis
9dc03b4442 [index] Avoid using getSatisfiedProtocolRequirements() when indexing the stdlib.
This is quite expensive and not worth the cost for indexing purposes of system modules.
2017-01-31 21:13:40 -08:00
Argyrios Kyrtzidis
a3919f5352 [index] Add testing for indexing a system overlay module, along with fine-grained control on the relations we want to index. 2017-01-31 11:14:21 -08:00
Nathan Hawes
e0ffbfb91b [indexer] Rename initCallRefIndexSymbol -> initFuncRefIndexSymbol as its now more general 2017-01-26 10:51:16 -08:00
Nathan Hawes
8ccccc6f74 [indexer] Fix crash in initVarRefIndexSymbols by handling func/var references in ImportDecls
IndexSwiftASTWalker::initVarRefIndexSymbols wasn't handling getCurrentExpr() returning a nullptr
as it does when processing a reference to someVar in the below import:
import var SomeModule.someVar

This patch fixes rdar://problem/30118572 and adds tests for import var/func references.
2017-01-26 09:15:42 -08:00
Argyrios Kyrtzidis
cfa1749836 [index] Report @IB and @GKInspectable properties in the index info. 2017-01-24 08:58:51 -08:00
Argyrios Kyrtzidis
703382701e [index] Mark unit test methods if the class subclasses XCTestCase.
This takes advantage of semantic checking during indexing so that it is more accurate.
2017-01-24 02:30:29 -08:00
Bob Wilson
c765d5e3a5 Merge remote-tracking branch 'origin/master' into master-next 2017-01-12 15:58:19 -08:00
Argyrios Kyrtzidis
4c7e04becd Merge pull request #6745 from akyrtzi/index-switch-to-general-accessor-kinds
[index] Switch to using the general accessor getter/setter symbol kinds.
2017-01-11 18:25:04 -08:00
Argyrios Kyrtzidis
7076ebbf72 [index] Switch to using the general accessor getter/setter symbol kinds. 2017-01-11 17:09:17 -08:00
Nathan Hawes
92f6d81455 [indexer] Fix incorrect RelationCalledBy for pseudo accessors 2017-01-11 16:07:09 -08:00
Argyrios Kyrtzidis
db8ec19f55 [index] Use the index symbol types and APIs from the clang header.
This avoids duplication and centralizes handling of symbols.
2017-01-10 14:49:07 -08:00
Bob Wilson
cf3a0458f2 Merge remote-tracking branch 'origin/master' into master-next 2017-01-10 09:05:23 -08:00
Nathan Hawes
563bc04da1 Merge pull request #6677 from nathawes/swift-indexing
Add roles and relations for Swift indexing
2017-01-09 14:48:35 -08:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
Brian Gesiak
663b92ece9 [AST] Completely replace Module with ModuleDecl
The typedef `swift::Module` was a temporary solution that allowed
`swift::Module` to be renamed to `swift::ModuleDecl` without requiring
every single callsite to be modified.

Modify all the callsites, and get rid of the typedef.
2017-01-08 00:36:08 -05:00
Nathan Hawes
4bc7435bb1 [indexer] provide names for pseudo accessors too 2017-01-06 14:26:12 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Nathan Hawes
8c45e20d3f [indexer] Add relations to IndexSymbol add a -print-indexed-symbols option to swift-ide-test for testing 2017-01-05 15:01:53 -08:00
Nathan Hawes
7f582c420d [indexer] When visiting a NominalTypeDecl, cover the type references in the where clause and generic param inheritance too.
Also rename ASTWalker::shouldWalkIntoFunctionGenericParams() to shouldWalkIntoGenericParams() since it's now used when walking NominalTypeDecl (not just AbstractFunctionDecl).
2017-01-05 14:54:59 -08:00
Bob Wilson
78b28243ff Merge remote-tracking branch 'origin/master' into master-next 2017-01-03 14:22:59 -08:00
Xi Ge
14f968a5ed SourceEntityWalker: Add a parameter to visitDeclReference() describing the kind of the reference under visit. NFC 2016-12-20 14:30:02 -08:00
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
Bob Wilson
deddf19aae Merge remote-tracking branch 'origin/master' into master-next 2016-12-13 10:23:03 -08:00
Slava Pestov
e59cdc8610 AST: Remove TypeBase::getDirectlyReferencedTypeDecl() 2016-12-04 21:15:02 -08:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
Hugh Bellamy
3a57546370 Fix warnings building swift/Index on Windows using MSVC 2016-12-02 12:18:09 +00:00