[PATCH] D98164: [clangd] Drop explicit specifier on define out-of-line

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 11 04:29:17 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1a5df174e1d: [clangd] Drop explicit specifier on define out-of-line (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98164/new/

https://reviews.llvm.org/D98164

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp


Index: clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp
@@ -267,6 +267,28 @@
             };)cpp",
           "  void A::foo() {}\n",
       },
+      {
+          R"cpp(
+            struct Foo {
+              explicit Fo^o(int) {}
+            };)cpp",
+          R"cpp(
+            struct Foo {
+              explicit Foo(int) ;
+            };)cpp",
+          " Foo::Foo(int) {}\n",
+      },
+      {
+          R"cpp(
+            struct Foo {
+              explicit explicit Fo^o(int) {}
+            };)cpp",
+          R"cpp(
+            struct Foo {
+              explicit explicit Foo(int) ;
+            };)cpp",
+          "  Foo::Foo(int) {}\n",
+      },
   };
   for (const auto &Case : Cases) {
     SCOPED_TRACE(Case.Test);
Index: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -272,6 +272,10 @@
     if (MD->isStatic())
       DelKeyword(tok::kw_static, {FD->getBeginLoc(), FD->getLocation()});
   }
+  if (const auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
+    if (CD->isExplicit())
+      DelKeyword(tok::kw_explicit, {FD->getBeginLoc(), FD->getLocation()});
+  }
 
   if (Errors)
     return std::move(Errors);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98164.329922.patch
Type: text/x-patch
Size: 1574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210311/81cf0bdb/attachment.bin>


More information about the cfe-commits mailing list