diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-15 18:58:50 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-15 18:58:50 +0000 |
commit | 14ec3f3acb46c7049256d87784ee44e1f96d0cd6 (patch) | |
tree | 3bb23c5da9241d4ed4b56ed8f61fcd433dcfc2ea /clang/lib/AST | |
parent | 5a89e0ef07ea80a03416e617e77ecd66ba11e698 (diff) | |
download | bcm5719-llvm-14ec3f3acb46c7049256d87784ee44e1f96d0cd6.tar.gz bcm5719-llvm-14ec3f3acb46c7049256d87784ee44e1f96d0cd6.zip |
structured document comment: patch to provide comment for overriding function
template when comment is comming from overridden declaration.
// rdar://12378793
llvm-svn: 165953
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/Comment.cpp | 15 | ||||
-rw-r--r-- | clang/lib/AST/CommentDumper.cpp | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index a443b91d096..a235b60bea4 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -310,6 +310,21 @@ StringRef ParamCommandComment::getParamName(comments::FullComment *FC) const { return Args[0].Text; } +StringRef TParamCommandComment::getParamName(comments::FullComment *FC) const { + if (FC && isPositionValid()) { + const TemplateParameterList *TPL = FC->getThisDeclInfo()->TemplateParameters; + for (unsigned i = 0, e = getDepth(); i != e; ++i) { + if (i == e-1) + return TPL->getParam(getIndex(i))->getName(); + const NamedDecl *Param = TPL->getParam(getIndex(i)); + if (const TemplateTemplateParmDecl *TTP = + dyn_cast<TemplateTemplateParmDecl>(Param)) + TPL = TTP->getTemplateParameters(); + } + } + return Args[0].Text; +} + } // end namespace comments } // end namespace clang diff --git a/clang/lib/AST/CommentDumper.cpp b/clang/lib/AST/CommentDumper.cpp index 36261c423be..4f51cd5622c 100644 --- a/clang/lib/AST/CommentDumper.cpp +++ b/clang/lib/AST/CommentDumper.cpp @@ -197,7 +197,7 @@ void CommentDumper::visitTParamCommandComment(const TParamCommandComment *C) { dumpComment(C); if (C->hasParamName()) { - OS << " Param=\"" << C->getParamName() << "\""; + OS << " Param=\"" << C->getParamName(const_cast<FullComment*>(FC)) << "\""; } if (C->isPositionValid()) { |