[Index] [clangd] Support for concept declarations and requires expressions
authorIlya Biryukov <ibiryukov@google.com>
Tue, 26 Apr 2022 13:38:28 +0000 (13:38 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 26 Apr 2022 13:50:01 +0000 (13:50 +0000)
commit75e16fd2c656fb7d27e6edc46dc1a63ff8323999
treef34fa2b8a35529d7b02eace2d49c942d363e07f5
parenta037eace91a350b2a45d0b901f547903df3d3cb3
[Index] [clangd] Support for concept declarations and requires expressions

Add support for concepts and requires expression in the clang index.
Genarate USRs for concepts.

Also change how `RecursiveASTVisitor` handles return type requirement in
requires expressions. The new code unpacks the synthetic template parameter
list used for storing the actual expression. This simplifies
implementation of the indexing. No code seems to depend on the original
traversal anyway and the synthesized template parameter list is easily
accessible from inside the requires expression if needed.

Add tests in the clangd codebase.

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

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D124441
18 files changed:
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/Quality.cpp
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
clang-tools-extra/clangd/unittests/TestIndex.cpp
clang-tools-extra/clangd/unittests/TestIndex.h
clang-tools-extra/clangd/unittests/XRefsTests.cpp
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Index/IndexSymbol.h
clang/lib/Index/IndexBody.cpp
clang/lib/Index/IndexDecl.cpp
clang/lib/Index/IndexSymbol.cpp
clang/lib/Index/IndexTypeSourceInfo.cpp
clang/lib/Index/IndexingContext.cpp
clang/lib/Index/USRGeneration.cpp
clang/tools/libclang/CXIndexDataConsumer.cpp