Author: Nico Weber Date: 2022-01-10T12:01:42-05:00 New Revision: cf90b3cf7e467db9052a2fd392faa68ef2f175d8
URL: https://github.com/llvm/llvm-project/commit/cf90b3cf7e467db9052a2fd392faa68ef2f175d8 DIFF: https://github.com/llvm/llvm-project/commit/cf90b3cf7e467db9052a2fd392faa68ef2f175d8.diff LOG: Revert "[clangd] Enable expand-auto for decltype(auto)." This reverts commit 37ec65e1d705f56fe5551de1dfcbac1e071588a2. Its prerequisite 55d96ac3dc56bdebea854952a724c2a50d96ce19 wsa reverted in c2293bc17dd09d552c5fdd13ff2b7c5738c5a10a. c2293bc's patch description claimed that it reverted 37ec65 as well, but it apparently didn't. See https://reviews.llvm.org/D116921#3231802 Added: Modified: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp index 914564e9ae218..3776e1c3505d1 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp @@ -96,7 +96,9 @@ bool ExpandAutoType::prepare(const Selection& Inputs) { if (auto *Node = Inputs.ASTSelection.commonAncestor()) { if (auto *TypeNode = Node->ASTNode.get<TypeLoc>()) { if (const AutoTypeLoc Result = TypeNode->getAs<AutoTypeLoc>()) { - if (!isStructuredBindingType(Node) && + // Code in apply() does handle 'decltype(auto)' yet. + if (!Result.getTypePtr()->isDecltypeAuto() && + !isStructuredBindingType(Node) && !isDeducedAsLambda(Node, Result.getBeginLoc()) && !isTemplateParam(Node)) CachedLocation = Result; diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp index 6d9d4362be7af..96574a67b5a46 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp @@ -71,8 +71,7 @@ TEST_F(ExpandAutoTypeTest, Test) { apply("void ns::Func() { au^to x = new ns::Class::Nested{}; }"), "void ns::Func() { ns::Class::Nested * x = new ns::Class::Nested{}; }"); - EXPECT_EQ(apply("dec^ltype(auto) x = 10;"), "int x = 10;"); - EXPECT_EQ(apply("decltype(au^to) x = 10;"), "int x = 10;"); + EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;"); // expanding types in structured bindings is syntactically invalid. EXPECT_UNAVAILABLE("const ^auto &[x,y] = (int[]){1,2};"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits