[PATCH] D45887: [CodeComplete] Fix completion at the end of keywords

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 20 09:48:34 PDT 2018


ilya-biryukov created this revision.
ilya-biryukov added reviewers: sammccall, bkramer, arphaman, aaron.ballman.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D45887

Files:
  lib/Lex/Lexer.cpp
  test/CodeCompletion/end-of-ident-macro.cpp
  test/CodeCompletion/end-of-ident.cpp
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45887.143335.patch
Type: text/x-patch
Size: 11702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180420/02befdbf/attachment.bin>


More information about the cfe-commits mailing list