diff options
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 30 | ||||
-rw-r--r-- | clang/lib/AST/Comment.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/CommentSema.cpp | 2 |
3 files changed, 24 insertions, 14 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index a58eca6a0a4..71764dbd971 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -374,6 +374,20 @@ static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, } } +comments::FullComment *ASTContext::cloneFullComment(comments::FullComment *FC, + const Decl *D) const { + comments::DeclInfo *ThisDeclInfo = new (*this) comments::DeclInfo; + ThisDeclInfo->CommentDecl = D; + ThisDeclInfo->IsFilled = false; + ThisDeclInfo->fill(); + ThisDeclInfo->CommentDecl = FC->getDecl(); + comments::FullComment *CFC = + new (*this) comments::FullComment(FC->getBlocks(), + ThisDeclInfo); + return CFC; + +} + comments::FullComment *ASTContext::getCommentForDecl( const Decl *D, const Preprocessor *PP) const { @@ -384,16 +398,9 @@ comments::FullComment *ASTContext::getCommentForDecl( ParsedComments.find(Canonical); if (Pos != ParsedComments.end()) { - if (Canonical != D && - (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D))) { - // case of method being redeclaration of the canonical, not - // overriding it; i.e. method in implementation, canonical in - // interface. Or, out-of-line cxx-method definition. + if (Canonical != D) { comments::FullComment *FC = Pos->second; - comments::FullComment *CFC = - new (*this) comments::FullComment(FC->getBlocks(), - FC->getThisDeclInfo(), - const_cast<Decl *>(D)); + comments::FullComment *CFC = cloneFullComment(FC, D); return CFC; } return Pos->second; @@ -411,10 +418,7 @@ comments::FullComment *ASTContext::getCommentForDecl( overridden); for (unsigned i = 0, e = overridden.size(); i < e; i++) { if (comments::FullComment *FC = getCommentForDecl(overridden[i], PP)) { - comments::FullComment *CFC = - new (*this) comments::FullComment(FC->getBlocks(), - FC->getThisDeclInfo(), - const_cast<Decl *>(D)); + comments::FullComment *CFC = cloneFullComment(FC, D); return CFC; } } diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index 09f4290f1b7..a443b91d096 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -304,6 +304,12 @@ void DeclInfo::fill() { IsFilled = true; } +StringRef ParamCommandComment::getParamName(comments::FullComment *FC) const { + if (FC && isParamIndexValid()) + return FC->getThisDeclInfo()->ParamVars[getParamIndex()]->getName(); + return Args[0].Text; +} + } // end namespace comments } // end namespace clang diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index 59dc6c72955..d664bdb6329 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -413,7 +413,7 @@ HTMLEndTagComment *Sema::actOnHTMLEndTag(SourceLocation LocBegin, FullComment *Sema::actOnFullComment( ArrayRef<BlockContentComment *> Blocks) { - FullComment *FC = new (Allocator) FullComment(Blocks, ThisDeclInfo, 0); + FullComment *FC = new (Allocator) FullComment(Blocks, ThisDeclInfo); resolveParamCommandIndexes(FC); return FC; } |