logic: record inheritance edges for implicit template specializations
This commit is contained in:
committed by
Eberhard Graether
parent
cd731a3798
commit
e81315c131
@@ -199,7 +199,10 @@ DEF_TRAVERSE_TYPE_PTR(Stmt, {}, {})
|
||||
// additionally: skip implicit CXXRecordDecls (this does not skip template specializations).
|
||||
bool CxxAstVisitor::TraverseCXXRecordDecl(clang::CXXRecordDecl *d)
|
||||
{
|
||||
if (utility::isImplicit(d) && d->getMemberSpecializationInfo() == nullptr)
|
||||
if (utility::isImplicit(d) &&
|
||||
d->getMemberSpecializationInfo() == nullptr &&
|
||||
!clang::isa<clang::ClassTemplateSpecializationDecl>(utility::getFirstDecl(d))
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -213,7 +216,7 @@ bool CxxAstVisitor::TraverseCXXRecordDecl(clang::CXXRecordDecl *d)
|
||||
|
||||
TraverseNestedNameSpecifierLoc(d->getQualifierLoc());
|
||||
|
||||
if (d->isCompleteDefinition())
|
||||
if (d->hasDefinition())
|
||||
{
|
||||
for (const auto& base : d->bases())
|
||||
{
|
||||
@@ -480,7 +483,8 @@ void CxxAstVisitor::traverseDeclContextHelper(clang::DeclContext* d)
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* child : d->decls()) {
|
||||
for (auto* child : d->decls())
|
||||
{
|
||||
// BlockDecls and CapturedDecls are traversed through BlockExprs and
|
||||
// CapturedStmts respectively.
|
||||
if (!llvm::isa<clang::BlockDecl>(child) && !llvm::isa<clang::CapturedDecl>(child))
|
||||
|
||||
@@ -15,6 +15,25 @@
|
||||
class CxxParserTestSuite: public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
void test_record_base_class_of_implicit_template_class_specialization()
|
||||
{
|
||||
std::shared_ptr<TestIntermediateStorage> client = parseCode(
|
||||
"template<class T, unsigned int N>\n"
|
||||
"class VectorBase {}; \n"
|
||||
"\n"
|
||||
"template<class T>\n"
|
||||
"class Vector2 : public VectorBase<T, 2> { void foo(); }; \n"
|
||||
"\n"
|
||||
"typedef Vector2<float> Vec2f; \n"
|
||||
"\n"
|
||||
"Vec2f v; \n"
|
||||
);
|
||||
|
||||
TS_ASSERT(utility::containsElement<std::wstring>(
|
||||
client->inheritances, L"Vector2<float> -> VectorBase<float, 2> <5:24 5:33>"
|
||||
));
|
||||
}
|
||||
|
||||
void test_cxx_parser_skips_implicit_template_method_definition_of_implicit_template_class_instantiation()
|
||||
{
|
||||
std::shared_ptr<TestIntermediateStorage> client = parseCode(
|
||||
|
||||
Reference in New Issue
Block a user