Skip to content

Commit db38152

Browse files
committed
[index] Remove unused local/param variables from index kinds
We don't index local variables or parameters, so remove the index symbol kinds.
1 parent e977d4b commit db38152

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

include/swift/Index/IndexSymbol.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,10 @@ enum class SymbolKind {
3838
GenericTypeParam,
3939

4040
Function,
41+
Variable,
4142
PrefixOperator,
4243
PostfixOperator,
4344
InfixOperator,
44-
45-
LocalVariable,
46-
GlobalVariable,
47-
ParamVariable,
48-
4945
Accessor,
5046
Subscript,
5147
EnumElement,

lib/Index/IndexSymbol.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ static SymbolKind getVarSymbolKind(const VarDecl *VD) {
5353
return SymbolKind::InstanceProperty;
5454
}
5555

56-
if (DC->isLocalContext())
57-
return SymbolKind::LocalVariable;
58-
return SymbolKind::GlobalVariable;
56+
assert(!DC->isLocalContext() && "local variable seen while indexing");
57+
return SymbolKind::Variable;
5958
}
6059

6160
SymbolKind index::getSymbolKindForDecl(const Decl *D) {
@@ -72,7 +71,8 @@ SymbolKind index::getSymbolKindForDecl(const Decl *D) {
7271
case DeclKind::Subscript: return SymbolKind::Subscript;
7372
case DeclKind::Constructor: return SymbolKind::Constructor;
7473
case DeclKind::Destructor: return SymbolKind::Destructor;
75-
case DeclKind::Param: return SymbolKind::ParamVariable;
74+
case DeclKind::Param:
75+
llvm_unreachable("unexpected parameter seen while indexing");
7676

7777
case DeclKind::Func:
7878
return getFuncSymbolKind(cast<FuncDecl>(D));

tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,8 @@ UIdent SwiftLangSupport::getUIDForSymbol(SymbolKind kind, SymbolSubKind subKind,
550550
return UID_FOR(FunctionPostfixOperator);
551551
case SymbolKind::InfixOperator:
552552
return UID_FOR(FunctionInfixOperator);
553-
case SymbolKind::LocalVariable:
554-
return UID_FOR(VarLocal);
555-
case SymbolKind::GlobalVariable:
553+
case SymbolKind::Variable:
556554
return UID_FOR(VarGlobal);
557-
case SymbolKind::ParamVariable:
558-
// There is no KindRefVarParam. It's not usually an interesting difference.
559-
return isRef ? KindRefVarLocal : KindDeclVarParam;
560555
case SymbolKind::InstanceMethod:
561556
return UID_FOR(MethodInstance);
562557
case SymbolKind::ClassMethod:

0 commit comments

Comments
 (0)