llvm-project/clang-tools-extra/clangd
Johan Vikstrom f497da3041 [clangd] Added highlighting for tokens that are macro arguments.
Summary:
Adds semantic highlighting for tokens that are a macro argument.
Example:
```
D_V(SomeVar);
```
The "SomeVar" inside the macro is highlighted as a variable now.

Tokens that are in a macro body expansion are ignored in this patch for three reasons.
* The spelling loc is inside the macro "definition" meaning it would highlight inside the macro definition (could probably easily be fixed by using getExpansionLoc instead of getSpellingLoc?)
* If wanting to highlight the macro definition this could create duplicate tokens. And if the tokens are of different types there would be conflicts (tokens in the same range but with different types). Say a macro defines some name and both a variable declaration and a function use this, there would be two tokens in the macro definition but one with Kind "Variable" and the other with Kind "Function".
* Thirdly, macro body expansions could come from a file that is not the main file (easily fixed, just check that the Loc is in the main file and not even a problem if we wanted to highlight the actual macro "invocation")

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64741

llvm-svn: 369275
2019-08-19 16:27:49 +00:00
..
benchmarks Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
clients/clangd-vscode [clangd][vscode] Surface the error when applying tweaks fails 2019-08-14 13:38:52 +00:00
fuzzer clangd-fuzzer: repair the build 2019-04-10 19:16:14 +00:00
include-mapping [clangd] Add include-mapping for C symbols. 2019-06-21 13:32:18 +00:00
index [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
indexer [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
refactor [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
test [clangd] Added special HighlightingKind for function parameters. 2019-08-19 07:51:39 +00:00
tool [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
unittests [clangd] Added highlighting for tokens that are macro arguments. 2019-08-19 16:27:49 +00:00
xpc [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
AST.cpp [clangd] Print qualifiers of out-of-line definitions in document outline 2019-08-14 12:51:04 +00:00
AST.h [clangd] Fix implicit template instatiations appearing as topLevelDecls. 2019-08-08 07:21:06 +00:00
CMakeLists.txt Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
CSymbolMap.inc [clangd] Add include-mapping for C symbols. 2019-06-21 13:32:18 +00:00
Cancellation.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Cancellation.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ClangdLSPServer.cpp [clangd] suppress -Wparentheses warning: suggest parentheses around ‘&&’ within ‘||’ 2019-08-16 13:20:51 +00:00
ClangdLSPServer.h [clangd] Don't use Bind() where C++14 move capture works 2019-08-15 14:16:06 +00:00
ClangdServer.cpp [clangd] Don't use Bind() where C++14 move capture works 2019-08-15 14:16:06 +00:00
ClangdServer.h [clangd] Duplicate lines of semantic highlightings sent removed. 2019-08-01 08:08:44 +00:00
ClangdUnit.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
ClangdUnit.h [clangd] Collect tokens of main files when building the AST 2019-06-19 14:03:19 +00:00
CodeComplete.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
CodeComplete.h [clangd] Use -completion-style=bundled by default if signature help is available 2019-07-08 17:27:15 +00:00
CodeCompletionStrings.cpp Code completion should not ignore default parameters in functions. 2019-08-07 16:52:21 +00:00
CodeCompletionStrings.h [clangd] Place cursor better after completing patterns 2019-05-28 15:33:37 +00:00
Compiler.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Compiler.h [clangd] Wait for compile command in ASTWorker instead of ClangdServer 2019-04-15 12:32:28 +00:00
Context.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Context.h [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Diagnostics.cpp [clangd] Drop diags from non-written #include. 2019-08-12 09:35:04 +00:00
Diagnostics.h [clangd] Ignore diags from builtin files 2019-07-30 10:26:51 +00:00
DraftStore.cpp [clangd] Fix error message with incorrect TextDocumentcontentChangeEvent.rangeLength 2019-08-05 08:14:13 +00:00
DraftStore.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ExpectedTypes.cpp [clangd] Compute expected type for templates 2019-05-28 13:56:21 +00:00
ExpectedTypes.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FS.cpp [clangd] Get rid of dots and dotsdots within GlobalCompilationDatabase 2019-07-18 16:13:23 +00:00
FS.h [clangd] Get rid of dots and dotsdots within GlobalCompilationDatabase 2019-07-18 16:13:23 +00:00
FSProvider.cpp [clangd] Unlink VFS working dir from OS working dir. Reland of r351051 2019-02-15 11:04:25 +00:00
FSProvider.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Features.inc.in [clangd] XPC transport layer 2019-01-16 00:24:22 +00:00
FileDistance.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FileDistance.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FindSymbols.cpp [clangd] Fix typos and grammar in a comment. NFC 2019-08-14 10:49:32 +00:00
FindSymbols.h [clangd] Type hierarchy subtypes 2019-06-16 02:31:37 +00:00
Format.cpp [clangd] Fix gcc warning by removing extra ";" 2019-06-11 06:02:01 +00:00
Format.h [clangd] Revamp textDocument/onTypeFormatting. 2019-06-10 14:26:21 +00:00
FormattedString.cpp [clangd] Separate chunks with a space when rendering markdown 2019-08-12 14:35:30 +00:00
FormattedString.h [clangd] Represent Hover result using FormattedString 2019-05-29 10:01:00 +00:00
Function.h [clangd] Remove Bind, use C++14 lambda captures instead. NFC 2019-08-16 09:20:01 +00:00
FuzzyMatch.cpp [clangd] Tune the fuzzy-matching algorithm 2019-03-15 14:00:49 +00:00
FuzzyMatch.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
GlobalCompilationDatabase.cpp [clangd] Fix background index not triggering on windows due to case mismatch. 2019-07-26 14:07:11 +00:00
GlobalCompilationDatabase.h [clangd] Fix background index not triggering on windows due to case mismatch. 2019-07-26 14:07:11 +00:00
Headers.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Headers.h [clangd][NFC] Typo in comment 2019-07-30 20:39:39 +00:00
IncludeFixer.cpp [clangd] Compute scopes eagerly in IncludeFixer 2019-08-06 11:37:50 +00:00
IncludeFixer.h [clangd] Compute scopes eagerly in IncludeFixer 2019-08-06 11:37:50 +00:00
JSONTransport.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Logger.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Logger.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Path.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Protocol.cpp [clangd] Add a callback mechanism for handling responses from client. 2019-08-05 12:48:09 +00:00
Protocol.h [clangd] Add a callback mechanism for handling responses from client. 2019-08-05 12:48:09 +00:00
Quality.cpp [clangd] cleanup: unify the implemenation of checking a location is inside main file. 2019-07-19 08:33:39 +00:00
Quality.h [clangd] Remove unused signature help quality signal. NFC 2019-06-06 08:32:25 +00:00
QueryDriverDatabase.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
RIFF.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RIFF.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Selection.cpp [clangd] Disallow extraction of expression-statements. 2019-08-09 23:40:54 +00:00
Selection.h [clangd] Disallow extraction of expression-statements. 2019-08-09 23:40:54 +00:00
SemanticHighlighting.cpp [clangd] Added highlighting for tokens that are macro arguments. 2019-08-19 16:27:49 +00:00
SemanticHighlighting.h [clangd] Added special HighlightingKind for function parameters. 2019-08-19 07:51:39 +00:00
SourceCode.cpp [clangd] Unfold SourceLocation flattening from findNameLoc in preparation for adding more overloads. NFC 2019-08-06 20:25:59 +00:00
SourceCode.h [clangd] Unfold SourceLocation flattening from findNameLoc in preparation for adding more overloads. NFC 2019-08-06 20:25:59 +00:00
StdSymbolMap.inc [clangd] Add include-mapping for C symbols. 2019-06-21 13:32:18 +00:00
TUScheduler.cpp [clangd] Don't use Bind() where C++14 move capture works 2019-08-15 14:16:06 +00:00
TUScheduler.h [clangd] Provide a way to publish highlightings in non-racy manner 2019-07-19 13:51:01 +00:00
Threading.cpp [clangd] Use llvm::set_thread_priority in background-index 2019-04-18 13:46:40 +00:00
Threading.h [clangd] Use llvm::set_thread_priority in background-index 2019-04-18 13:46:40 +00:00
Trace.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Trace.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Transport.h [clangd] Use #if CLANGD_BUILD_XPC because it may be defined as 0 2019-04-10 15:45:54 +00:00
URI.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
URI.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
XRefs.cpp [clangd] Unfold SourceLocation flattening from findNameLoc in preparation for adding more overloads. NFC 2019-08-06 20:25:59 +00:00
XRefs.h [clangd] Implement typeHierarchy/resolve for subtypes 2019-07-13 03:24:48 +00:00