} else if (const auto *FWD =
Result.Nodes.getNodeAs<clang::CXXRecordDecl>("fwd_decl")) {
// Skip all forwad declarations which appear after moved class declaration.
- if (RemovedDecls.empty())
- MovedDecls.emplace_back(FWD, &Result.Context->getSourceManager());
+ if (RemovedDecls.empty()) {
+ if (const auto *DCT = FWD->getDescribedClassTemplate()) {
+ MovedDecls.emplace_back(DCT, &Result.Context->getSourceManager());
+ } else {
+ MovedDecls.emplace_back(FWD, &Result.Context->getSourceManager());
+ }
+ }
} else if (const auto *ANS = Result.Nodes.getNodeAs<clang::NamespaceDecl>(
"anonymous_ns")) {
MovedDecls.emplace_back(ANS, &Result.Context->getSourceManager());
const char TestHeader[] = "namespace a {\n"
"class C1; // test\n"
+ "template <typename T> class C2;\n"
"namespace b {\n"
"// This is a Foo class\n"
"// which is used in\n"
const char ExpectedTestHeader[] = "namespace a {\n"
"class C1; // test\n"
+ "template <typename T> class C2;\n"
"namespace b {\n"
"\n"
"class Foo2 {\n"
"#define NEW_FOO_H\n"
"namespace a {\n"
"class C1; // test\n"
+ "template <typename T> class C2;\n"
"namespace b {\n"
"// This is a Foo class\n"
"// which is used in\n"