[clang-rename] Handle designated initializers.
authorDaniele Castagna <dcastagna@google.com>
Mon, 12 Apr 2021 20:15:14 +0000 (13:15 -0700)
committerJustin Lebar <justin.lebar@gmail.com>
Mon, 12 Apr 2021 20:15:14 +0000 (13:15 -0700)
commit7dd60688992526bb7ee0c7846e9abd591fc3e297
tree48fade7c4dde5cb881787b558e44507b7874a421
parentba62ebc48e8c424ce3a78ba01acda679d536dd47
[clang-rename] Handle designated initializers.

clang Tooling, and more specifically Refactoring/Rename, have support
code to extract source locations given a Unified Symbol Resolution set.
This support code is used by clang-rename and other tools that might not
be in the tree.

Currently field designated initializer are not supported.
So, renaming S::a to S::b in this code:

  S s = { .a = 10 };

will not extract the field designated initializer for a (the 'a' after the
dot).

This patch adds support for field designated initialized to
RecursiveSymbolVisitor and RenameLocFinder that is used in
createRenameAtomicChanges.

Differential Revision: https://reviews.llvm.org/D100310
clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
clang/unittests/Rename/RenameClassTest.cpp