This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa8124eea9df5: [clangd] Add missing readonly modifier for const generic parameters (authored by tom-anders).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135892/new/ https://reviews.llvm.org/D135892 Files: clang-tools-extra/clangd/SemanticHighlighting.cpp clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -855,6 +855,17 @@ const char *$LocalVariable_decl_readonly[[s]] = $LocalVariable_readonly_static[[__func__]]; } )cpp", + // Issue 1022: readonly modifier for generic parameter + R"cpp( + template <typename $TemplateParameter_decl[[T]]> + auto $Function_decl[[foo]](const $TemplateParameter[[T]] $Parameter_decl_readonly[[template_type]], + const $TemplateParameter[[auto]] $Parameter_decl_readonly[[auto_type]], + const int $Parameter_decl_readonly[[explicit_type]]) { + return $Parameter_readonly[[template_type]] + + $Parameter_readonly[[auto_type]] + + $Parameter_readonly[[explicit_type]]; + } + )cpp", // Explicit template specialization R"cpp( struct $Class_decl[[Base]]{}; Index: clang-tools-extra/clangd/SemanticHighlighting.cpp =================================================================== --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -164,7 +164,7 @@ // Whether T is const in a loose sense - is a variable with this type readonly? bool isConst(QualType T) { - if (T.isNull() || T->isDependentType()) + if (T.isNull()) return false; T = T.getNonReferenceType(); if (T.isConstQualified())
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -855,6 +855,17 @@ const char *$LocalVariable_decl_readonly[[s]] = $LocalVariable_readonly_static[[__func__]]; } )cpp", + // Issue 1022: readonly modifier for generic parameter + R"cpp( + template <typename $TemplateParameter_decl[[T]]> + auto $Function_decl[[foo]](const $TemplateParameter[[T]] $Parameter_decl_readonly[[template_type]], + const $TemplateParameter[[auto]] $Parameter_decl_readonly[[auto_type]], + const int $Parameter_decl_readonly[[explicit_type]]) { + return $Parameter_readonly[[template_type]] + + $Parameter_readonly[[auto_type]] + + $Parameter_readonly[[explicit_type]]; + } + )cpp", // Explicit template specialization R"cpp( struct $Class_decl[[Base]]{}; Index: clang-tools-extra/clangd/SemanticHighlighting.cpp =================================================================== --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -164,7 +164,7 @@ // Whether T is const in a loose sense - is a variable with this type readonly? bool isConst(QualType T) { - if (T.isNull() || T->isDependentType()) + if (T.isNull()) return false; T = T.getNonReferenceType(); if (T.isConstQualified())
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits