diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp --- a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp +++ b/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(FD)) { + if (CD->isExplicit()) + DelKeyword(tok::kw_explicit, {FD->getBeginLoc(), FD->getLocation()}); + } if (Errors) return std::move(Errors); diff --git a/clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp --- a/clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp +++ b/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);