Commit Graph

29 Commits

Author SHA1 Message Date
Dylan Sturgeon
5e38e1ebe8 Fix missing refs to accesor when shadowing with if-let shorthand.
After ce55a854b9 the references to accessors for the shadowed accessor were discarded when indexing without locals.
2025-04-01 11:43:30 -07:00
Dylan Sturgeon
ce55a854b9 Emit references to shadowed variables in if-let shorthands as variables when indexing locals is enabled.
Track the original-decl/captured decl as part of the symbol passed to the IndexConsumer. This allows the Rename consumer to check if the symbol is a shadowed reference to a decl being renamed, without the index skipping the other relevant output when visiting shadowing variables.

https://github.com/swiftlang/swift/issues/76805
2024-10-22 16:43:24 -07:00
Ben Barham
38d2b96e6d [NFC] Small Index.cpp cleanups 2022-09-20 13:06:47 -07:00
Varun Gandhi
52dcd47456 [NFC] Remove redundant includes for llvm/ADT/SmallString.h. 2020-05-31 13:07:45 -07:00
Michael Wyman
70e38937e3 Return Optional<> offset from getLineColAndOffset. 2019-08-27 11:08:53 -07:00
Michael Wyman
bd10f2a7c9 Address PR feedback. IndexSymbol.offset is now an llvm::Optional<unsigned>, getOffsetInBuffer is now replaced by returning a tuple with the offset from getLineColAndOffset (renamed from getLineCol). 2019-08-27 10:53:49 -07:00
Michael Wyman
89f89ab3e0 Make symbol info only store symbol occurrence offset, not start/end offset. The rest can be determined from the source manager by finding the token's SourceLoc. 2019-08-26 10:20:36 -07:00
Michael Wyman
a355af2890 Make Swift indexing code capture symbol start/end offset within the current source file. 2019-08-12 14:39:31 -07:00
Bruno Rocha
bf84b297f8 [SourceKit] Allow module references to be indexed (#19243)
Module references get indexed as a 'module' symbol; they get USRs similar to how clang would assign a USR for a module reference.

JIRA: https://bugs.swift.org/browse/SR-8677
2018-09-28 12:21:38 -07:00
practicalswift
40cf4d183d [gardening] Use consistent spacing after if, for and while 2017-04-14 17:35:36 +02: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
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
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
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
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
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
Argyrios Kyrtzidis
ec042460fe [SourceKit] Report attributes of decls for the indexing request. 2016-05-05 16:44:34 -07:00
Ben Langmuir
ad34f89d5b [index] Add UnitTest SymbolSubKind and collapse the IndexSymbol inheritance
Fold UnitTest into the subkind, now that it's a bitself, and then remove
the unnecessary inheritance for IndexSymbol and its SourceKit indexing
equivalent.
2016-04-29 19:04:27 -07:00
Ben Langmuir
6096b8b93c [index] Make IndexSymbol's subkind into a bitset
This follows a similar change to clang indexing, and will allow us to
add overlapping sub kinds such as "UnitTest", etc.
2016-04-29 19:04:26 -07:00
Ben Langmuir
ef4e84b8d6 [index] Subsume CallRefIndexSymbol into IndexSymbol
Eventually we should just have one IndexSymbol, with all the
information. Once we kill FuncDeclIndexSymbol and can get rid of the
enum,  we will regain most of the bytes we lost by inlining receiverUSR.
2016-04-29 19:04:26 -07:00
Ben Langmuir
50eeeb7430 [index] Add 'call' and 'isDynamic' roles 2016-04-29 19:04:25 -07:00
Ben Langmuir
1b1320b9f1 [index] Thread through SymbolRoleSet as a generalization of "bool isRef"
As a first step toward having more detailed "role" information, thread
through a SymbolRole bitset.  For now it just contains the existing ref
vs. definition status.
2016-04-29 19:04:24 -07:00
Ben Langmuir
5523266715 [index] Remove unreachable materializeForSet case in indexer
We already had it marked unreachable in SourceKit, so lift that up into
the libIndex and remove the unnecessary enum case.
2016-04-28 16:51:03 -07:00
Ben Langmuir
db381525d0 [index] Remove unused local/param variables from index kinds
We don't index local variables or parameters, so remove the index symbol
kinds.
2016-04-28 16:51:02 -07:00
Ben Langmuir
e977d4bd54 [index] Remove import.sourcefile kind from indexing
We don't support importing source files in source code, and they only
showed up in the index under failure conditions.
2016-04-28 16:51:01 -07:00
Ben Langmuir
8f17b13f61 [index] Cache USR and name for decls
We were calculating these for every decl-occurrence, but we really only
need them once per decl.
2016-04-25 13:29:27 -07:00
Ben Langmuir
ad269b0e1f [index] Move core indexing code out of SourceKit
Leaving only the SourceKit-specific code (e.g. UID generation) behind in
SourceKit.

rdar://problem/22348041
2016-04-14 13:13:54 -07:00