diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-04-24 14:52:00 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-04-24 14:52:00 +0000 |
commit | b4b85f2033fcbca13fb154979da8895056eb6254 (patch) | |
tree | f761c585d8bf8f3c729bb2d2f52f745154bbea29 /clang/lib/Index/IndexSymbol.cpp | |
parent | cab4617132b0342d1774ff71dcbd16fde2409bd4 (diff) | |
download | bcm5719-llvm-b4b85f2033fcbca13fb154979da8895056eb6254.tar.gz bcm5719-llvm-b4b85f2033fcbca13fb154979da8895056eb6254.zip |
[index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly
llvm-svn: 301183
Diffstat (limited to 'clang/lib/Index/IndexSymbol.cpp')
-rw-r--r-- | clang/lib/Index/IndexSymbol.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp index ea66b701795..0bfa19346b4 100644 --- a/clang/lib/Index/IndexSymbol.cpp +++ b/clang/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"); } |