diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-27 21:18:39 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-27 21:18:39 +0000 |
commit | 01b065117bb9335365bc0eb6e22848daf3e26cb4 (patch) | |
tree | 40287d431f5fb318b815820d5940d4751c3bfde8 /clang/lib/AST/ASTContext.cpp | |
parent | cf9dae17b7711b7c8458827c9f0d03a4ae9281b1 (diff) | |
download | bcm5719-llvm-01b065117bb9335365bc0eb6e22848daf3e26cb4.tar.gz bcm5719-llvm-01b065117bb9335365bc0eb6e22848daf3e26cb4.zip |
Comment parsing: attach any tag type's documentation to its typedef if latter
does not have one of its own. // rdar://13067629
Original patch (r173586 and r173587) by Fariborz Jahanian, modified by me.
llvm-svn: 173626
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 7ba64e32f35..8091d685f73 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -85,6 +85,14 @@ RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const { return NULL; } + if (const ClassTemplateSpecializationDecl *CTSD = + dyn_cast<ClassTemplateSpecializationDecl>(D)) { + TemplateSpecializationKind TSK = CTSD->getSpecializationKind(); + if (TSK == TSK_ImplicitInstantiation || + TSK == TSK_Undeclared) + return NULL; + } + if (const EnumDecl *ED = dyn_cast<EnumDecl>(D)) { if (ED->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) return NULL; @@ -428,12 +436,12 @@ comments::FullComment *ASTContext::getCommentForDecl( return cloneFullComment(FC, D); } else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { - // Attach enum's documentation to its typedef if latter + // Attach any tag type's documentation to its typedef if latter // does not have one of its own. QualType QT = TD->getUnderlyingType(); - if (const EnumType *ET = QT->getAs<EnumType>()) - if (const EnumDecl *ED = ET->getDecl()) - if (comments::FullComment *FC = getCommentForDecl(ED, PP)) + if (const TagType *TT = QT->getAs<TagType>()) + if (const Decl *TD = TT->getDecl()) + if (comments::FullComment *FC = getCommentForDecl(TD, PP)) return cloneFullComment(FC, D); } return NULL; |