This patch adds a simple mechanism to disallow global rename
on std symbols. We might extend it to other symbols, e.g. protobuf.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Unit tests: pass. 62202 tests passed, 0 failed and 815 were skipped.
clang-tidy: fail. clang-tidy found 0 errors and 1 warnings. 1 of them are added as review comments below (why?).
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
145–146 | nit: maybe just if (!shouldCollectSymbol...) return nonindexable; ? | |
474 | locateDeclAt is already working on NamedDecls but returning a set of Decls could you rather update that helper to return a set of NamedDecls instead? | |
clang-tools-extra/clangd/refactor/RenameBlacklist.cpp | ||
14 ↗ | (On Diff #240497) | I don't think there's much value in having that in its own file, could you move it into the rename.cpp ? |
clang-tools-extra/clangd/unittests/RenameTests.cpp | ||
454 | maybe SCOPEDT_TRACE(T) instead? |
update the code.
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
474 | I think the main problem is that NamedDecl->getCanonicalDecl() returns a Decl*, which we need to do a dyn_cast. | |
clang-tools-extra/clangd/refactor/RenameBlacklist.cpp | ||
14 ↗ | (On Diff #240497) | I thought we will extend this in the near future, moved to rename.cpp now as it is pretty short. |
clang-tools-extra/clangd/unittests/RenameTests.cpp | ||
454 | good point, reverted the change in this patch, and will do this in a separate patch. |
Unit tests: pass. 62202 tests passed, 0 failed and 815 were skipped.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
Unit tests: pass. 62202 tests passed, 0 failed and 815 were skipped.
clang-tidy: pass.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
474 |
yeah, this is true for most cases, but it is not safe, we have corn cases, see the comment in SymbolCollector about ObjCPropertyDecl. |
Unit tests: pass. 62202 tests passed, 0 failed and 815 were skipped.
clang-tidy: pass.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
148 | looks like it is still not clang-formatted | |
474 | I don't think that's relevant in here though, it is performing the cast on a Decl. It is the ASTNode.OrigD that has been populated by libIndex. Am I missing something? |
address comment.
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
474 | ah, you are right. I thought ASTNode.OrigD was the decl getting from getCanonicalDecl, but it turns out not. I also checked with the Decl::getCanonicalDecl default implementation, if the Decl subclass doesn't override this method, it just returns itself. so it is safe for NamedDecl. |
clang-tools-extra/clangd/refactor/Rename.cpp | ||
---|---|---|
225 | nit: maybe revert this one? |
Unit tests: pass. 62202 tests passed, 0 failed and 815 were skipped.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
nit: maybe just if (!shouldCollectSymbol...) return nonindexable; ?