diff options
| author | Haojian Wu <hokein.wu@gmail.com> | 2019-11-11 10:34:29 +0100 |
|---|---|---|
| committer | Haojian Wu <hokein.wu@gmail.com> | 2019-11-11 10:46:52 +0100 |
| commit | 41104a9406dd284d984f7bee30c7756fcfe2b59e (patch) | |
| tree | 0ad0b4160d14a4409c27593cfa4e4df48296bd2d /clang-tools-extra/clangd/unittests/IndexTests.cpp | |
| parent | add7f2aba7b9f9db3bbbeacd07650f6e1e9f0094 (diff) | |
| download | bcm5719-llvm-41104a9406dd284d984f7bee30c7756fcfe2b59e.tar.gz bcm5719-llvm-41104a9406dd284d984f7bee30c7756fcfe2b59e.zip | |
[clangd] Fix a regression of not showing documentation from forward declarations.
Summary:
There is a regression from https://reviews.llvm.org/D68467. Unlike class
forward declarations, function ducomentation is written in the declaration in
headers, the function definition doesn't contain any documentation, cases like:
```
foo.h
// this is foo.
void foo();
foo.cc
void foo() {}
```
we should still show documentation from the foo declaration.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69961
Diffstat (limited to 'clang-tools-extra/clangd/unittests/IndexTests.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/unittests/IndexTests.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/unittests/IndexTests.cpp b/clang-tools-extra/clangd/unittests/IndexTests.cpp index 9f0265d4190..e868828d786 100644 --- a/clang-tools-extra/clangd/unittests/IndexTests.cpp +++ b/clang-tools-extra/clangd/unittests/IndexTests.cpp @@ -408,13 +408,20 @@ TEST(MergeIndexTest, Refs) { } TEST(MergeIndexTest, NonDocumentation) { + using index::SymbolKind; Symbol L, R; L.ID = R.ID = SymbolID("x"); L.Definition.FileURI = "file:/x.h"; R.Documentation = "Forward declarations because x.h is too big to include"; - - Symbol M = mergeSymbol(L, R); - EXPECT_EQ(M.Documentation, ""); + for (auto ClassLikeKind : + {SymbolKind::Class, SymbolKind::Struct, SymbolKind::Union}) { + L.SymInfo.Kind = ClassLikeKind; + EXPECT_EQ(mergeSymbol(L, R).Documentation, ""); + } + + L.SymInfo.Kind = SymbolKind::Function; + R.Documentation = "Documentation from non-class symbols should be included"; + EXPECT_EQ(mergeSymbol(L, R).Documentation, R.Documentation); } MATCHER_P2(IncludeHeaderWithRef, IncludeHeader, References, "") { |

