diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2019-09-25 15:44:26 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2019-09-25 15:44:26 +0000 |
commit | 007e4fe9017c15e1791d451260dc4a61715e53a5 (patch) | |
tree | 3308928473e393a8e8d8cbc02e4f6a3b4016ee74 | |
parent | de44f434e828708daeb7a98cf19f57ef03077c05 (diff) | |
download | bcm5719-llvm-007e4fe9017c15e1791d451260dc4a61715e53a5.tar.gz bcm5719-llvm-007e4fe9017c15e1791d451260dc4a61715e53a5.zip |
[clangd] Change constness of parameters to findExplicitRefs
Summary:
Recursive AST requires non-const ast nodes, but it doesn't really
mutate them. In addition to that, in clangd we mostly have const ast nodes. So
it makes sense to move the const_cast into callee rather than having it at every
caller in the future.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68027
llvm-svn: 372888
-rw-r--r-- | clang-tools-extra/clangd/FindTarget.cpp | 8 | ||||
-rw-r--r-- | clang-tools-extra/clangd/FindTarget.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp index 4d69318b579..2dc8f279b33 100644 --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -616,15 +616,15 @@ private: }; } // namespace -void findExplicitReferences(Stmt *S, +void findExplicitReferences(const Stmt *S, llvm::function_ref<void(ReferenceLoc)> Out) { assert(S); - ExplicitReferenceColletor(Out).TraverseStmt(S); + ExplicitReferenceColletor(Out).TraverseStmt(const_cast<Stmt *>(S)); } -void findExplicitReferences(Decl *D, +void findExplicitReferences(const Decl *D, llvm::function_ref<void(ReferenceLoc)> Out) { assert(D); - ExplicitReferenceColletor(Out).TraverseDecl(D); + ExplicitReferenceColletor(Out).TraverseDecl(const_cast<Decl *>(D)); } llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, DeclRelation R) { diff --git a/clang-tools-extra/clangd/FindTarget.h b/clang-tools-extra/clangd/FindTarget.h index 86f1e8b113d..80a8e787d62 100644 --- a/clang-tools-extra/clangd/FindTarget.h +++ b/clang-tools-extra/clangd/FindTarget.h @@ -101,9 +101,9 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, ReferenceLoc R); /// qualifiers. /// FIXME: currently this does not report references to overloaded operators. /// FIXME: extend to report location information about declaration names too. -void findExplicitReferences(Stmt *S, +void findExplicitReferences(const Stmt *S, llvm::function_ref<void(ReferenceLoc)> Out); -void findExplicitReferences(Decl *D, +void findExplicitReferences(const Decl *D, llvm::function_ref<void(ReferenceLoc)> Out); /// Similar to targetDecl(), however instead of applying a filter, all possible |