summaryrefslogtreecommitdiff
path: root/lib/Index/IndexSymbol.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-26 19:24:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-26 19:24:09 +0000
commitf0c55418e2b09eaab37c820d3756cc1b4584d084 (patch)
tree9263bf60f263bb5a7aaa4d2c1be43e5fc4d942e0 /lib/Index/IndexSymbol.cpp
parent583e75cce441388bc562fa225d23499261a0091e (diff)
Notes
Diffstat (limited to 'lib/Index/IndexSymbol.cpp')
-rw-r--r--lib/Index/IndexSymbol.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp
index ea66b7017951c..0bfa19346b4ef 100644
--- a/lib/Index/IndexSymbol.cpp
+++ b/lib/Index/IndexSymbol.cpp
@@ -318,6 +318,20 @@ SymbolInfo index::getSymbolInfo(const Decl *D) {
if (Info.Properties & (unsigned)SymbolProperty::Generic)
Info.Lang = SymbolLanguage::CXX;
+ auto getExternalSymAttr = [](const Decl *D) -> ExternalSourceSymbolAttr* {
+ if (auto *attr = D->getAttr<ExternalSourceSymbolAttr>())
+ return attr;
+ if (auto *dcd = dyn_cast<Decl>(D->getDeclContext())) {
+ if (auto *attr = dcd->getAttr<ExternalSourceSymbolAttr>())
+ return attr;
+ }
+ return nullptr;
+ };
+ if (auto *attr = getExternalSymAttr(D)) {
+ if (attr->getLanguage() == "Swift")
+ Info.Lang = SymbolLanguage::Swift;
+ }
+
return Info;
}
@@ -458,6 +472,7 @@ StringRef index::getSymbolLanguageString(SymbolLanguage K) {
case SymbolLanguage::C: return "C";
case SymbolLanguage::ObjC: return "ObjC";
case SymbolLanguage::CXX: return "C++";
+ case SymbolLanguage::Swift: return "Swift";
}
llvm_unreachable("invalid symbol language kind");
}