[PATCH] D39430: [clangd] formatting: don't ignore style

Raoul Wols via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 2 06:41:26 PST 2017


rwols updated this revision to Diff 125267.
rwols added a comment.
Herald added a subscriber: klimek.

- Merge with upstream revision 319613
- Fix FixItHints not getting applied correctly in all cases. The problem is that clang::CharSourceRange can either be a TokenRange or a CharRange. In the case of a TokenRange, we have to determine the end of the token ourselves (this would occur, for example, in things like `if (i=1) { ... }`; the fixit hint to replace `=` with `==` would be a TokenRange for some reason).

  Consequently, a tiny change had to be made to the fixits.test file, where the fixit hint to replace `=` with `==` would previously have an empty replacement range, whereas now it has a replacement range of length 1, exactly removing the `=` and inserting `==` in its place.

After playing around with these changes more I'm fairly certain I'm on the right
track for converting clang ranges/positions to clangd ranges/positions.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D39430

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/JSONRPCDispatcher.cpp
  clangd/JSONRPCDispatcher.h
  test/clangd/diagnostics.test
  test/clangd/execute-command.test
  test/clangd/extra-flags.test
  test/clangd/fixits.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39430.125267.patch
Type: text/x-patch
Size: 36261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171202/8c80fb02/attachment-0001.bin>


More information about the cfe-commits mailing list