[PATCH] D47256: [clangd] Fix code completion in MACROs with stringification.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 06:27:46 PDT 2018


ioeric created this revision.
ioeric added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, jkorous, MaskRay, klimek.

Currently, we only handle the first callback from sema code completion
and ignore results from potential following callbacks. This causes
causes loss of completion results when multiple contexts are tried by Sema.

For example, we wouldn't get any completion result in the following completion
as the first attemped context is natural language which has no
candidate. The parser would backtrack and tried a completion with AST
semantic, which would find candidate "::x".

  void f(const char*, int);
  #define F(x) f(#x, x)
  int x;
  void main() {
  	F(::^);
  }

To fix this, we only process a sema callback when it gives completion results or
the context supports index-based completion.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D47256

Files:
  clangd/CodeComplete.cpp
  unittests/clangd/CodeCompleteTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47256.148199.patch
Type: text/x-patch
Size: 6978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180523/9d217e0e/attachment.bin>


More information about the cfe-commits mailing list