Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ getFunctionSourceCode(const FunctionDecl *FD, const DeclContext *TargetContext,
return;

for (const NamedDecl *ND : Ref.Targets) {
if (ND->getKind() == Decl::TemplateTypeParm)
return;
if (ND->getDeclContext() != Ref.Targets.front()->getDeclContext()) {
elog("Targets from multiple contexts: {0}, {1}",
printQualifiedName(*Ref.Targets.front()),
Expand Down
12 changes: 6 additions & 6 deletions clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,29 +411,29 @@ inline typename O1<T, U...>::template O2<V, A>::E O1<T, U...>::template O2<V, A>
R"cpp(
struct Foo {
template <typename T, bool B = true>
void ^bar() {}
T ^bar() { return {}; }
};)cpp",
R"cpp(
struct Foo {
template <typename T, bool B = true>
void bar() ;
T bar() ;
};template <typename T, bool B>
inline void Foo::bar() {}
inline T Foo::bar() { return {}; }
)cpp",
""},

// Class template with member template
{
R"cpp(
template <typename T> struct Foo {
template <typename U> void ^bar(const T& t, const U& u) {}
template <typename U> T ^bar(const T& t, const U& u) { return {}; }
};)cpp",
R"cpp(
template <typename T> struct Foo {
template <typename U> void bar(const T& t, const U& u) ;
template <typename U> T bar(const T& t, const U& u) ;
};template <typename T>
template <typename U>
inline void Foo<T>::bar(const T& t, const U& u) {}
inline T Foo<T>::bar(const T& t, const U& u) { return {}; }
)cpp",
""},
};
Expand Down
Loading