[LibTooling] Fix dangling references in RangeSelector.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 23 May 2019 17:11:33 +0000 (17:11 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 23 May 2019 17:11:33 +0000 (17:11 +0000)
commitaa7a2c547e2802f15c9346bff18c5d5c585ab882
tree43b24469038a3c80e7f2e2236fc6df4838461cce
parentc5ec2a2bc1980e21910ca5c649cc0c3346979fa7
[LibTooling] Fix dangling references in RangeSelector.

Summary:
RangeSelector had a number of cases of capturing a StringRef in a lambda, which
lead to dangling references. This change converts all uses in the API of
`StringRef` to `std::string` to avoid this problem. `std::string` in the API is
a reasonable choice, because the combinators are always storing the string
beyond the life of the combinator construction.

Reviewers: ilya-biryukov, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361514
clang/include/clang/Tooling/Refactoring/RangeSelector.h
clang/lib/Tooling/Refactoring/RangeSelector.cpp