llvm-project/clang-tools-extra/clangd
Sam McCall 33c3ef2fbe [CodeCompletion][clangd] Clean __uglified parameter names in completion & hover
Underscore-uglified identifiers are used in standard library implementations to
guard against collisions with macros, and they hurt readability considerably.
(Consider `push_back(Tp_ &&__value)` vs `push_back(Tp value)`.
When we're describing an interface, the exact names of parameters are not
critical so we can drop these prefixes.

This patch adds a new PrintingPolicy flag that can applies this stripping
when recursively printing pieces of AST.
We set it in code completion/signature help, and in clangd's hover display.
All three features also do a bit of manual poking at names, so fix up those too.

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

Differential Revision: https://reviews.llvm.org/D116387
2022-01-26 15:51:17 +01:00
..
benchmarks [clangd] Fix build after D115243 2022-01-13 13:44:19 +01:00
fuzzer
include-mapping [clangd][StdSymbolMap] Prefer std::remove from algorithm 2022-01-12 15:25:42 +01:00
index [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
indexer
quality
refactor [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
support [clangd] Attempt to fix buildbots 2021-10-25 20:16:59 -07:00
test [clangd] Implement textDocument/typeDefinition 2022-01-13 22:15:10 +01:00
tool [clangd] Add option to use dirty file contents when building preambles. 2022-01-17 10:55:35 +00:00
unittests [CodeCompletion][clangd] Clean __uglified parameter names in completion & hover 2022-01-26 15:51:17 +01:00
xpc [NFC][clangd] fix llvm-namespace-comment finding 2021-11-16 15:10:32 +00:00
AST.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
AST.h [clangd] Don't index __reserved_names in headers. 2022-01-05 16:34:04 +01:00
ASTSignals.cpp
ASTSignals.h
CMakeLists.txt [clangd] Helper for determining member insertion point. 2022-01-03 17:59:45 +01:00
CSymbolMap.inc
ClangdLSPServer.cpp [clangd] Implement textDocument/typeDefinition 2022-01-13 22:15:10 +01:00
ClangdLSPServer.h [clangd] Implement textDocument/typeDefinition 2022-01-13 22:15:10 +01:00
ClangdServer.cpp [clangd] Fail inlayHints requests on content changes 2022-01-21 12:40:49 +01:00
ClangdServer.h [clangd] Add option to use dirty file contents when building preambles. 2022-01-17 10:55:35 +00:00
CodeComplete.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
CodeComplete.h [clangd] Provide documentation as MarkupContent in signaturehelp 2021-12-10 12:58:08 +01:00
CodeCompletionStrings.cpp
CodeCompletionStrings.h
CollectMacros.cpp
CollectMacros.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
CompileCommands.cpp [NFC][clangd] Use table to collect option aliases 2022-01-24 14:27:14 -08:00
CompileCommands.h
Compiler.cpp [clangd] Add integration test for crash handling 2021-10-27 11:52:31 +02:00
Compiler.h [clangd] Add integration test for crash handling 2021-10-27 11:52:31 +02:00
Config.cpp
Config.h [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
ConfigCompile.cpp [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
ConfigFragment.h [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
ConfigProvider.cpp
ConfigProvider.h
ConfigYAML.cpp [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
Diagnostics.cpp [clangd] Better handling `\n` in the synthesized diagnostic message. 2022-01-17 09:27:58 +01:00
Diagnostics.h [clangd] Suppress warning about system_header pragma when editing headers 2022-01-13 22:24:05 +01:00
DraftStore.cpp
DraftStore.h
DumpAST.cpp
DumpAST.h [clang] Forward-declare DynTypedNode (NFC) 2022-01-23 13:28:04 -08:00
ExpectedTypes.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
ExpectedTypes.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
FS.cpp
FS.h
Feature.cpp
Feature.h
FeatureModule.cpp
FeatureModule.h
Features.inc.in
FileDistance.cpp
FileDistance.h
FindSymbols.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
FindSymbols.h
FindTarget.cpp [clangd] Sort targets before printing for tests 2022-01-19 14:06:53 +01:00
FindTarget.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
Format.cpp
Format.h
FuzzyMatch.cpp [NFC][clangd] cleanup llvm-else-after-return findings 2021-11-17 14:37:03 +00:00
FuzzyMatch.h
GlobalCompilationDatabase.cpp
GlobalCompilationDatabase.h
HeaderSourceSwitch.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
HeaderSourceSwitch.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
Headers.cpp [clangd] Basic IncludeCleaner support for c/c++ standard library 2022-01-03 18:19:56 +01:00
Headers.h [clangd] Fix windows build after 478863ef58 2022-01-03 20:17:20 +01:00
HeuristicResolver.cpp [clangd] Use castAs<> instead of getAs<> to avoid dereference of nullptr 2022-01-23 13:24:36 +00:00
HeuristicResolver.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
Hover.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
Hover.h [clangd] Add desugared type to hover 2021-12-08 13:28:12 +08:00
IncludeCleaner.cpp [clangd] Basic IncludeCleaner support for c/c++ standard library 2022-01-03 18:19:56 +01:00
IncludeCleaner.h [clangd] Basic IncludeCleaner support for c/c++ standard library 2022-01-03 18:19:56 +01:00
IncludeFixer.cpp [clangd] Include fixer for missing functions in C 2022-01-10 12:17:19 +01:00
IncludeFixer.h [clangd] Add fixes for clang "include <foo.h>" diagnostics 2021-12-08 16:16:53 +01:00
InlayHints.cpp [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
InlayHints.h [clangd] Polish clangd/inlayHints and expose them by default. 2022-01-07 15:12:43 +01:00
JSONTransport.cpp [NFC][clangd] cleanup llvm-else-after-return findings 2021-11-17 14:37:03 +00:00
LSPBinder.h
ParsedAST.cpp Re-land "Cache the locations of NOLINTBEGIN/END blocks" with fix for build bot 2022-01-27 01:03:27 +13:00
ParsedAST.h
PathMapping.cpp [NFC][clangd] cleanup llvm-else-after-return findings 2021-11-17 14:37:03 +00:00
PathMapping.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
Preamble.cpp [clangd] Suppress warning about system_header pragma when editing headers 2022-01-13 22:24:05 +01:00
Preamble.h [clangd] Cleanup unneeded use of shared_ptr. NFC 2021-12-15 02:13:50 +01:00
Protocol.cpp [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
Protocol.h [clangd] Add designator inlay hints for initializer lists. 2022-01-26 00:35:29 +01:00
Quality.cpp [clangd] Don't index __reserved_names in headers. 2022-01-05 16:34:04 +01:00
Quality.h
QueryDriverDatabase.cpp
README.md
RIFF.cpp
RIFF.h
Selection.cpp [clangd] NFC, emit source ranges in selection debug messages. 2022-01-19 16:06:58 +01:00
Selection.h [clangd] SelectionTree should prefer lexical declcontext 2021-10-28 17:39:35 +02:00
SemanticHighlighting.cpp Initialize HighlightingsBuilder::Resolver 2022-01-07 15:21:22 -08:00
SemanticHighlighting.h
SemanticSelection.cpp
SemanticSelection.h
SourceCode.cpp [llvm][ADT] Implement `BitVector::{pop_,}back` 2022-01-21 14:50:53 +01:00
SourceCode.h [clangd] Don't index __reserved_names in headers. 2022-01-05 16:34:04 +01:00
StdSymbolMap.inc [clangd][StdSymbolMap] Prefer std::remove from algorithm 2022-01-12 15:25:42 +01:00
TUScheduler.cpp [NFC][clangd] cleaning up llvm-qualified-auto 2022-01-25 13:26:33 +00:00
TUScheduler.h [clangd] Cleanup unneeded use of shared_ptr. NFC 2021-12-15 02:13:50 +01:00
TidyProvider.cpp [clangd] Disable hicpp-invalid-access-moved inside clangd 2021-11-25 10:27:45 +01:00
TidyProvider.h
Transport.h
URI.cpp
URI.h [clangd] cleanup of header guard names 2021-12-02 15:58:35 +00:00
XRefs.cpp [clangd] Implement textDocument/typeDefinition 2022-01-13 22:15:10 +01:00
XRefs.h [clangd] Implement textDocument/typeDefinition 2022-01-13 22:15:10 +01:00

README.md

clangd

clangd is a language server, and provides C++ IDE features to editors. This is not its documentation.

Communication channels

If you have any questions or feedback, you can reach community and developers through one of these channels:

Building and testing clangd

For a minimal setup on building clangd:

  • Clone the LLVM repo to $LLVM_ROOT.

  • Create a build directory, for example at $LLVM_ROOT/build.

  • Inside the build directory run: cmake $LLVM_ROOT/llvm/ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra".

    • We suggest building in Release mode as building DEBUG binaries requires considerably more resources. You can check Building LLVM with CMake documentation for more details about cmake flags.
    • In addition to that using Ninja as a generator rather than default make is preferred. To do that consider passing -G Ninja to cmake invocation.
    • Finally, you can turn on assertions via -DLLVM_ENABLE_ASSERTS=On.
  • Afterwards you can build clangd with cmake --build $LLVM_ROOT/build --target clangd, similarly run tests by changing target to check-clangd.