[SourceKit] Cursor info: for extension decls, the cursor info query always returns the extended nominal's group name.

This commit is contained in:
Xi Ge
2016-03-02 16:10:25 -08:00
parent 3f20eb242d
commit 65a3aade7e
4 changed files with 29 additions and 12 deletions

View File

@@ -1546,7 +1546,14 @@ Optional<StringRef> ModuleFile::getGroupNameById(unsigned Id) const {
}
Optional<StringRef> ModuleFile::getGroupNameForDecl(const Decl *D) const {
auto Triple = getCommentForDecl(D);
auto GroupD = D;
// Extensions always exist in the same group with the nominal.
if (auto ED = dyn_cast_or_null<ExtensionDecl>(D->getDeclContext()->
getInnermostTypeContext())) {
GroupD = ED->getExtendedType()->getAnyNominal();
}
auto Triple = getCommentForDecl(GroupD);
if (!Triple.hasValue()) {
return None;
}