From 8f2ae425621d748fa7e5481529f51ad4ed836590 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 24 Apr 2017 14:52:00 +0000 Subject: [index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301183 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexSymbol.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/Index') diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp index ea66b70179..0bfa19346b 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()) + return attr; + if (auto *dcd = dyn_cast(D->getDeclContext())) { + if (auto *attr = dcd->getAttr()) + 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"); } -- cgit v1.2.3