On Aug 7, 2012, at 4:37 PM, Dmitri Gribenko <[email protected]> wrote:
> Hello,
>
> This patch changes the way we attach comments to declarations by not
> only looking at the declaration itself, but also walking the
> redeclaration chain: the previous declaration might have had a
> documentation comment.
>
> Please review.
RawComment *RC = NULL;
+ for (Decl::redecl_iterator I = D->redecls_begin(),
+ E = D->redecls_end();
+ I != E; ++I) {
+ RC = getRawCommentForDeclNoCache(*I);
+ // If we found a comment, it should be a documentation comment.
+ assert(!RC || RC->isDocumentation());
+ if (RC)
+ break;
+ }
This uncached search seems a bit pessimistic. Why not peek into the cache for
each of the redeclarations, to avoid repeatedly performing the unchanged
search. Then, when we actually do find a raw comment attached to one of the
declarations, update the cache for each of the redeclarations to point at that
same raw comment?
- Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits