[IDE] Move determination of the decl group at the Decl::getGroupName() caller.

This commit is contained in:
Argyrios Kyrtzidis
2016-05-08 16:27:46 -07:00
parent 3cf31e12bb
commit 8ce372dca9
2 changed files with 26 additions and 23 deletions

View File

@@ -1560,17 +1560,6 @@ Optional<CommentInfo> ModuleFile::getCommentForDecl(const Decl *D) const {
const static StringRef Separator = "/";
static const Decl* getGroupDecl(const Decl *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();
}
return GroupD;
}
Optional<StringRef> ModuleFile::getGroupNameById(unsigned Id) const {
if (!GroupNamesMap || GroupNamesMap->count(Id) == 0)
return None;
@@ -1596,8 +1585,7 @@ Optional<StringRef> ModuleFile::getSourceFileNameById(unsigned Id) const {
}
Optional<StringRef> ModuleFile::getGroupNameForDecl(const Decl *D) const {
auto GroupD = getGroupDecl(D);
auto Triple = getCommentForDecl(GroupD);
auto Triple = getCommentForDecl(D);
if (!Triple.hasValue()) {
return None;
}
@@ -1607,8 +1595,7 @@ Optional<StringRef> ModuleFile::getGroupNameForDecl(const Decl *D) const {
Optional<StringRef>
ModuleFile::getSourceFileNameForDecl(const Decl *D) const {
auto GroupD = getGroupDecl(D);
auto Triple = getCommentForDecl(GroupD);
auto Triple = getCommentForDecl(D);
if (!Triple.hasValue()) {
return None;
}