[PATCH] D135892: [clangd] Add missing readonly modifier for const generic parameters
Tom Praschan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 09:39:00 PDT 2022
tom-anders created this revision.
tom-anders added reviewers: nridge, sammccall.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
tom-anders requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Fixes https://github.com/clangd/clangd/issues/1222. As discussed there, we saw no reason to keep this check.
Repository:
rG LLVM Github Monorepo
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
@@ -847,6 +847,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())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135892.467511.patch
Type: text/x-patch
Size: 1670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221013/c7af13e0/attachment.bin>
More information about the cfe-commits
mailing list