llvm-project/clang/lib/Lex
Sam McCall 128ce70eef [CodeCompletion] Avoid spurious signature help for init-list args
Somewhat surprisingly, signature help is emitted as a side-effect of
computing the expected type of a function argument.
The reason is that both actions require enumerating the possible
function signatures and running partial overload resolution, and doing
this twice would be wasteful and complicated.

Change #1: document this, it's subtle :-)

However, sometimes we need to compute the expected type without having
reached the code completion cursor yet - in particular to allow
completion of designators.
eb4ab3358c did this but introduced a
regression - it emits signature help in the wrong location as a side-effect.

Change #2: only emit signature help if the code completion cursor was reached.

Currently there is PP.isCodeCompletionReached(), but we can't use it
because it's set *after* running code completion.
It'd be nice to set this implicitly when the completion token is lexed,
but ConsumeCodeCompletionToken() makes this complicated.

Change #3: call cutOffParsing() *first* when seeing a completion token.

After this, the fact that the Sema::Produce*SignatureHelp() functions
are even more confusing, as they only sometimes do that.
I don't want to rename them in this patch as it's another large
mechanical change, but we should soon.

Change #4: prepare to rename ProduceSignatureHelp() to GuessArgumentType() etc.

Differential Revision: https://reviews.llvm.org/D98488
2021-03-16 12:46:40 +01:00
..
CMakeLists.txt Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
DependencyDirectivesSourceMinimizer.cpp Avoid including FileSystem.h from MemoryBuffer.h 2020-02-29 12:30:23 -08:00
HeaderMap.cpp FileManager: Use llvm::Expected in new getFileRef API 2019-08-26 18:29:51 +00:00
HeaderSearch.cpp Revert "Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef" 2020-12-14 22:05:08 -05:00
Lexer.cpp [NFC] Use higher level constructs to check for whitespace/newlines in the lexer 2021-03-15 18:27:19 +01:00
LiteralSupport.cpp [clang][lex] Speculative fix for buffer overrun on raw string parse 2021-03-15 15:13:47 +01:00
MacroArgs.cpp Remove cache for macro arg stringization 2019-07-30 17:58:22 +00:00
MacroInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModuleMap.cpp Revert "Module: Use FileEntryRef and DirectoryEntryRef in Umbrella, Header, and DirectoryName, NFC" 2021-02-23 09:57:28 -08:00
PPCaching.cpp [Lex] Allow to consume tokens while preprocessing 2019-05-17 09:32:05 +00:00
PPCallbacks.cpp Avoid including FileManager.h from SourceManager.h 2020-03-11 13:53:12 -07:00
PPConditionalDirectiveRecord.cpp Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point. NFC 2019-07-03 08:13:17 +00:00
PPDirectives.cpp [CodeCompletion] Avoid spurious signature help for init-list args 2021-03-16 12:46:40 +01:00
PPExpressions.cpp Don't allow __VA_OPT__ to be detected by #ifdef. 2021-01-27 13:34:15 -08:00
PPLexerChange.cpp Lexer: Update the Lexer to use MemoryBufferRef, NFC 2020-10-19 19:10:21 -04:00
PPMacroExpansion.cpp Don't allow __VA_OPT__ to be detected by #ifdef. 2021-01-27 13:34:15 -08:00
Pragma.cpp [NFC] Fix compiler warnings due to integer comparison of different signedness 2020-09-11 15:32:03 +01:00
PreprocessingRecord.cpp Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point. NFC 2019-07-03 08:13:17 +00:00
Preprocessor.cpp [CodeCompletion] Avoid spurious signature help for init-list args 2021-03-16 12:46:40 +01:00
PreprocessorLexer.cpp Factor out repeated code parsing and concatenating header-names from 2019-03-19 01:51:19 +00:00
ScratchBuffer.cpp SourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable, NFC 2020-10-23 13:22:47 -04:00
TokenConcatenation.cpp C++2a -> C++20 in some identifiers; NFC. 2020-04-21 15:37:19 -04:00
TokenLexer.cpp Revert "Suppress non-conforming GNU paste extension in all standard-conforming modes" 2021-01-27 10:59:57 -08:00
UnicodeCharSets.h clang: Fix typo in comment 2019-08-21 15:41:29 +00:00