summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-rename/USRFinder.cpp
diff options
context:
space:
mode:
authorKirill Bobyrev <omtcyfz@gmail.com>2016-08-09 07:14:48 +0000
committerKirill Bobyrev <omtcyfz@gmail.com>2016-08-09 07:14:48 +0000
commit31fd7fb5e651432a4b554527098dba1f65527150 (patch)
tree21a8571b0701509a866689fcfa9b5d1ddcce1572 /clang-tools-extra/clang-rename/USRFinder.cpp
parenta10549d3e9439349cd092ec1c8fa63270e34d7ae (diff)
downloadbcm5719-llvm-31fd7fb5e651432a4b554527098dba1f65527150.tar.gz
bcm5719-llvm-31fd7fb5e651432a4b554527098dba1f65527150.zip
[clang-rename] fix bug with initializer lists
Clang-rename is currently not able to find a symbol in initializer list. This patch fixes described issue. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D23193 llvm-svn: 278099
Diffstat (limited to 'clang-tools-extra/clang-rename/USRFinder.cpp')
-rw-r--r--clang-tools-extra/clang-rename/USRFinder.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-rename/USRFinder.cpp b/clang-tools-extra/clang-rename/USRFinder.cpp
index dff0bb9aef5..a586bc610ec 100644
--- a/clang-tools-extra/clang-rename/USRFinder.cpp
+++ b/clang-tools-extra/clang-rename/USRFinder.cpp
@@ -90,6 +90,25 @@ public:
TypeEndLoc);
}
+ bool VisitCXXConstructorDecl(clang::CXXConstructorDecl *ConstructorDecl) {
+ for (auto &Initializer : ConstructorDecl->inits()) {
+ if (Initializer->getSourceOrder() == -1) {
+ // Ignore implicit initializers.
+ continue;
+ }
+ if (const clang::FieldDecl *FieldDecl = Initializer->getMember()) {
+ const SourceLocation InitBeginLoc = Initializer->getSourceLocation(),
+ InitEndLoc = Lexer::getLocForEndOfToken(
+ InitBeginLoc, 0, Context.getSourceManager(),
+ Context.getLangOpts());
+ if (!setResult(FieldDecl, InitBeginLoc, InitEndLoc)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
// Other:
const NamedDecl *getNamedDecl() { return Result; }
OpenPOWER on IntegriCloud