]> granicus.if.org Git - clang/commit
[CodeComplete] Fix completion at the end of keywords
authorIlya Biryukov <ibiryukov@google.com>
Tue, 24 Apr 2018 13:48:53 +0000 (13:48 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 24 Apr 2018 13:48:53 +0000 (13:48 +0000)
commita408f8d27bfd5bab55c39ef2a6fff6850be4a351
treeb843f387ee06b64c2066e4f5eaf89c7b0841177e
parent7140ad92debc63af78a9c50dcad2a0b6d4ebc680
[CodeComplete] Fix completion at the end of keywords

Summary:
Make completion behave consistently no matter if it is run at the
start, in the middle or at the end of an identifier that happens to
be a keyword or a macro name. Since completion is often ran on
incomplete identifiers, they may turn into keywords by accident.

For example, we should produce same results for all of these
completion points:

    // ^ is completion point.
    ^class
    cla^ss
    class^

Previously clang produced different results for the last case (as if
the completion point was after a space: `class ^`).

This change also updates some offsets in tests that (unintentionally?)
relied on the old behavior.

Reviewers: sammccall, bkramer, arphaman, aaron.ballman

Reviewed By: sammccall

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330717 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
lib/Lex/Lexer.cpp
test/CodeCompletion/end-of-ident-macro.cpp [new file with mode: 0644]
test/CodeCompletion/end-of-ident.cpp [new file with mode: 0644]
test/CodeCompletion/macros.c
test/CodeCompletion/namespace.cpp
test/CodeCompletion/operator.cpp
test/CodeCompletion/tag.c
test/CodeCompletion/tag.cpp
test/CodeCompletion/using-namespace.cpp
test/CodeCompletion/using.cpp
test/Index/complete-exprs.c
test/Index/complete-preprocessor.m