[AST] Attach comment in `/** doc */ typedef struct A {} B` to B as well as A.
authorSam McCall <sam.mccall@gmail.com>
Wed, 13 Nov 2019 20:30:31 +0000 (21:30 +0100)
committerSam McCall <sam.mccall@gmail.com>
Mon, 18 Nov 2019 10:09:23 +0000 (11:09 +0100)
commita433e7141fb3f697e6430437ee73b19076603c1b
treedabfdb927350a788d2ed2df1d4da7778f3adebeb
parent2d739f98d8a53e38bf9faa88cdb6b0c2a363fb77
[AST] Attach comment in `/** doc */ typedef struct A {} B` to B as well as A.

Summary:
Semantically they're the same thing, and it's important when the underlying
struct is anonymous.

There doesn't seem to be a problem attaching the same comment to multiple things
as it already happens with `/** doc */ int a, b;`

This affects an Index test but the results look better (name present, USR points
to the typedef).

Fixes https://github.com/clangd/clangd/issues/189

Reviewers: kadircet, lh123

Subscribers: ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70203
clang-tools-extra/clangd/unittests/XRefsTests.cpp
clang/lib/AST/ASTContext.cpp
clang/test/Index/annotate-comments-typedef.m
clang/test/Sema/warn-documentation.cpp