[SourceKit] Add decl.var.parameters entries to the fully annotated decl

This is the first part of adding parameter substructure so that clients
can reason about more of the function declaration.

rdar://problem/24292226
This commit is contained in:
Ben Langmuir
2016-02-24 11:39:47 -08:00
parent 184efb5e1c
commit 3e9bfa137d
6 changed files with 76 additions and 55 deletions

View File

@@ -637,19 +637,29 @@ void ClangCommentPrinter::avoidPrintDeclPost(const Decl *D) {
}
void ClangCommentPrinter::printDeclPre(const Decl *D) {
if (auto ClangN = D->getClangNode()) {
printCommentsUntil(ClangN);
if (shouldPrintNewLineBefore(ClangN)) {
*this << "\n";
printIndent();
// Skip parameters, since we do not gracefully handle nested declarations on a
// single line.
// FIXME: we should fix that, since it also affects struct members, etc.
if (!isa<ParamDecl>(D)) {
if (auto ClangN = D->getClangNode()) {
printCommentsUntil(ClangN);
if (shouldPrintNewLineBefore(ClangN)) {
*this << "\n";
printIndent();
}
updateLastEntityLine(ClangN.getSourceRange().getBegin());
}
updateLastEntityLine(ClangN.getSourceRange().getBegin());
}
return OtherPrinter.printDeclPre(D);
}
void ClangCommentPrinter::printDeclPost(const Decl *D) {
OtherPrinter.printDeclPost(D);
// Skip parameters; see printDeclPre().
if (isa<ParamDecl>(D))
return;
for (auto CommentText : PendingComments) {
*this << " " << ASTPrinter::sanitizeUtf8(CommentText);
}