Skip to content

Commit 6e5fa59

Browse files
authored
Merge pull request #219 from ahoppen/swift-structs-not-class-like
Don’t consider Swift structs class-like
2 parents 44a69df + 777bf01 commit 6e5fa59

File tree

4 files changed

+2
-18
lines changed

4 files changed

+2
-18
lines changed

include/IndexStoreDB/Core/Symbol.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ class Symbol {
203203
SymbolLanguage getLanguage() const { return SymInfo.Lang; }
204204

205205
bool isCallable() const { return SymInfo.isCallable(); }
206-
bool isClassLike() const { return SymInfo.isClassLike(); }
207-
bool isClassLikeOrExtension() const { return SymInfo.isClassLikeOrExtension(); }
208206

209207
void print(raw_ostream &OS) const;
210208
};

lib/Core/Symbol.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ bool SymbolInfo::isCallable() const {
3333
}
3434
}
3535

36-
bool SymbolInfo::isClassLike() const {
37-
switch (Kind) {
38-
case SymbolKind::Class:
39-
case SymbolKind::Struct:
40-
return Lang != SymbolLanguage::C;
41-
default:
42-
return false;
43-
}
44-
}
45-
46-
bool SymbolInfo::isClassLikeOrExtension() const {
47-
return isClassLike() || Kind == SymbolKind::Extension;
48-
}
49-
5036
bool SymbolInfo::preferDeclarationAsCanonical() const {
5137
if (Lang == SymbolLanguage::ObjC) {
5238
return Kind == SymbolKind::Class ||

lib/Database/ImportTransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ IDCode ImportTransaction::Implementation::addSymbolInfo(IDCode provider, StringR
8686
if (symInfo.Properties.contains(SymbolProperty::UnitTest) &&
8787
roles.contains(SymbolRole::Definition)) {
8888
Optional<GlobalSymbolKind> unitTestGlobalKind;
89-
if (symInfo.isClassLikeOrExtension())
89+
if (symInfo.Kind == SymbolKind::Class || symInfo.Kind == SymbolKind::Extension)
9090
unitTestGlobalKind = GlobalSymbolKind::TestClassOrExtension;
9191
else if (symInfo.Kind == SymbolKind::InstanceMethod)
9292
unitTestGlobalKind = GlobalSymbolKind::TestMethod;

lib/Index/SymbolIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void SymbolIndexImpl::importSymbols(ImportTransaction &import, SymbolDataProvide
152152
std::uninitialized_copy(Name.begin(), Name.end(), copiedStr);
153153
StringRef copiedName = StringRef(copiedStr, Name.size());
154154
// FIXME: Make this part of the compiler indexing output. E.g. a C++-like 'struct' should be a 'class' kind.
155-
if (Info.isClassLike())
155+
if (Info.Kind == SymbolKind::Struct && Info.Lang == SymbolLanguage::CXX)
156156
Info.Kind = SymbolKind::Class;
157157
auto pair = CoreSymbols.insert(std::make_pair(USR, CoreSymbolData{copiedName, Info, Roles, RelatedRoles}));
158158
bool wasInserted = pair.second;

0 commit comments

Comments
 (0)