hokein created this revision. hokein added a reviewer: kbobyrev. Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov. Herald added a project: clang.
It was disabled because we don't handle explicit template specialization well (due to the index limitation). renaming templates is normal in practic, rather than disabling it, this patch allows to rename them though it is not perfect (just a known limitation). Context: https://github.com/clangd/clangd/issues/280 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D74709 Files: clang-tools-extra/clangd/refactor/Rename.cpp clang-tools-extra/clangd/unittests/RenameTests.cpp Index: clang-tools-extra/clangd/unittests/RenameTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/RenameTests.cpp +++ clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -887,6 +887,23 @@ } )cpp", }, + { + // class templates. + R"cpp( + template <typename T> + class [[Foo]] {}; + // FIXME: explicit template specilizations are not supported due the + // clangd index limitations. + template <> + class Foo<double> {}; + )cpp", + R"cpp( + #include "foo.h" + void func() { + [[F^oo]]<int> foo; + } + )cpp", + }, { // class methods. R"cpp( Index: clang-tools-extra/clangd/refactor/Rename.cpp =================================================================== --- clang-tools-extra/clangd/refactor/Rename.cpp +++ clang-tools-extra/clangd/refactor/Rename.cpp @@ -184,13 +184,6 @@ if (!Index) return ReasonToReject::NoIndexProvided; - // Blacklist symbols that are not supported yet in cross-file mode due to the - // limitations of our index. - // FIXME: Renaming templates requires to rename all related specializations, - // our index doesn't have this information. - if (RenameDecl.getDescribedTemplate()) - return ReasonToReject::UnsupportedSymbol; - // FIXME: Renaming virtual methods requires to rename all overridens in // subclasses, our index doesn't have this information. // Note: Within-file rename does support this through the AST.
Index: clang-tools-extra/clangd/unittests/RenameTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/RenameTests.cpp +++ clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -887,6 +887,23 @@ } )cpp", }, + { + // class templates. + R"cpp( + template <typename T> + class [[Foo]] {}; + // FIXME: explicit template specilizations are not supported due the + // clangd index limitations. + template <> + class Foo<double> {}; + )cpp", + R"cpp( + #include "foo.h" + void func() { + [[F^oo]]<int> foo; + } + )cpp", + }, { // class methods. R"cpp( Index: clang-tools-extra/clangd/refactor/Rename.cpp =================================================================== --- clang-tools-extra/clangd/refactor/Rename.cpp +++ clang-tools-extra/clangd/refactor/Rename.cpp @@ -184,13 +184,6 @@ if (!Index) return ReasonToReject::NoIndexProvided; - // Blacklist symbols that are not supported yet in cross-file mode due to the - // limitations of our index. - // FIXME: Renaming templates requires to rename all related specializations, - // our index doesn't have this information. - if (RenameDecl.getDescribedTemplate()) - return ReasonToReject::UnsupportedSymbol; - // FIXME: Renaming virtual methods requires to rename all overridens in // subclasses, our index doesn't have this information. // Note: Within-file rename does support this through the AST.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits