[clang-tools-extra] r372888 - [clangd] Change constness of parameters to findExplicitRefs
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 25 08:44:26 PDT 2019
Author: kadircet
Date: Wed Sep 25 08:44:26 2019
New Revision: 372888
URL: http://llvm.org/viewvc/llvm-project?rev=372888&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clangd/FindTarget.cpp
clang-tools-extra/trunk/clangd/FindTarget.h
Modified: clang-tools-extra/trunk/clangd/FindTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FindTarget.cpp?rev=372888&r1=372887&r2=372888&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FindTarget.cpp (original)
+++ clang-tools-extra/trunk/clangd/FindTarget.cpp Wed Sep 25 08:44:26 2019
@@ -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) {
Modified: clang-tools-extra/trunk/clangd/FindTarget.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FindTarget.h?rev=372888&r1=372887&r2=372888&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FindTarget.h (original)
+++ clang-tools-extra/trunk/clangd/FindTarget.h Wed Sep 25 08:44:26 2019
@@ -101,9 +101,9 @@ llvm::raw_ostream &operator<<(llvm::raw_
/// 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
More information about the cfe-commits
mailing list