[cfe-commits] r173516 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Index/annotate-comments-typedef.m
Douglas Gregor
dgregor at apple.com
Fri Jan 25 15:28:40 PST 2013
On Jan 25, 2013, at 2:48 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Fri Jan 25 16:48:32 2013
> New Revision: 173516
>
> URL: http://llvm.org/viewvc/llvm-project?rev=173516&view=rev
> Log:
> Attach enum's documentation to its typedef if
> latter does not have one of its own. // rdar://13067629
>
> Added:
> cfe/trunk/test/Index/annotate-comments-typedef.m
> Modified:
> cfe/trunk/lib/AST/ASTContext.cpp
>
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=173516&r1=173515&r2=173516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jan 25 16:48:32 2013
> @@ -434,6 +434,16 @@ comments::FullComment *ASTContext::getCo
> }
> }
> }
> + else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
> + QualType QT = TD->getUnderlyingType();
> + if (const EnumType *ET = QT->getAs<EnumType>()) {
> + if (const EnumDecl *ED = ET->getDecl())
> + if (comments::FullComment *FC = getCommentForDecl(ED, PP)) {
> + comments::FullComment *CFC = cloneFullComment(FC, D);
> + return CFC;
> + }
> + }
> + }
> return NULL;
> }
Shouldn't this apply for all tag types? For example:
/** Comment about Foo */
typedef struct { … } Foo;
?
- Doug
More information about the cfe-commits
mailing list