[clangd] Fix a crash when renaming operator.
authorHaojian Wu <hokein@google.com>
Mon, 16 Sep 2019 10:16:56 +0000 (10:16 +0000)
committerHaojian Wu <hokein@google.com>
Mon, 16 Sep 2019 10:16:56 +0000 (10:16 +0000)
commitaf28bb65023ef989e9079717626a9e3080bb50d3
treeca3a833fd85191a05257fefa08bcf1951a66b49a
parent1d74940b319c7b6aea49f94730e408586fd76a82
[clangd] Fix a crash when renaming operator.

Summary:
The renamelib uses a tricky way to calculate the end location by relying
on decl name, this is incorrect for the overloaded operator (the name is
"operator++" instead of "++"), which will cause out-of-file offset.

We also disable renaming operator symbol, this case is tricky, and
renamelib doesnt handle it properly.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 371971
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp
clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h