[PATCH] D117463: [clangd] Disable expand-auto action on constrained auto.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 17 02:38:07 PST 2022
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
hokein requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117463
Files:
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
Index: clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
@@ -82,6 +82,11 @@
ExtraArgs.push_back("-std=c++17");
EXPECT_UNAVAILABLE("template <au^to X> class Y;");
+ ExtraArgs.back() = "-std=c++20";
+ EXPECT_UNAVAILABLE(
+ R"cpp(template <typename T> concept C = true;
+^C a^uto abc();
+ )cpp");
}
} // namespace
Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -96,7 +96,7 @@
if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
if (auto *TypeNode = Node->ASTNode.get<TypeLoc>()) {
if (const AutoTypeLoc Result = TypeNode->getAs<AutoTypeLoc>()) {
- if (!isStructuredBindingType(Node) &&
+ if (!isStructuredBindingType(Node) && !Result.isConstrained() &&
!isDeducedAsLambda(Node, Result.getBeginLoc()) &&
!isTemplateParam(Node))
CachedLocation = Result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117463.400476.patch
Type: text/x-patch
Size: 1285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220117/a51fa760/attachment.bin>
More information about the cfe-commits
mailing list