[PATCH] D68630: [clangd] Disable expand auto on decltype(auto)
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 07:10:28 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b36caf45e5e: [clangd] Disable expand auto on decltype(auto) (authored by ilya-biryukov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68630/new/
https://reviews.llvm.org/D68630
Files:
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
clang-tools-extra/clangd/unittests/TweakTests.cpp
Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -528,6 +528,8 @@
// replace array types
EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
R"cpp(const char * x = "test")cpp");
+
+ EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
}
TWEAK_TEST(ExtractFunction);
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
@@ -61,7 +61,9 @@
if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
if (auto *TypeNode = Node->ASTNode.get<TypeLoc>()) {
if (const AutoTypeLoc Result = TypeNode->getAs<AutoTypeLoc>()) {
- CachedLocation = Result;
+ // Code in apply() does handle 'decltype(auto)' yet.
+ if (!Result.getTypePtr()->isDecltypeAuto())
+ CachedLocation = Result;
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68630.223846.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191008/f557e65d/attachment-0001.bin>
More information about the cfe-commits
mailing list