logic: fixed bug where explicit template specialization records edge pointing to self
This commit is contained in:
committed by
Eberhard Graether
parent
7a5d1f7d2b
commit
1bb16deb3b
@@ -350,7 +350,67 @@ bool CxxAstVisitor::TraverseCXXConstructExpr(clang::CXXConstructExpr* s)
|
|||||||
DEF_TRAVERSE_TYPE_PTR(CXXTemporaryObjectExpr, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(CXXTemporaryObjectExpr, {}, {})
|
||||||
DEF_TRAVERSE_TYPE_PTR(LambdaExpr, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(LambdaExpr, {}, {})
|
||||||
DEF_TRAVERSE_TYPE_PTR(FunctionDecl, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(FunctionDecl, {}, {})
|
||||||
DEF_TRAVERSE_TYPE_PTR(ClassTemplateSpecializationDecl, {}, {})
|
|
||||||
|
// same as base::TraverseClassTemplateSpecializationDecl but without traversing the typeloc of the template specialitation itself
|
||||||
|
bool CxxAstVisitor::TraverseClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl *D)
|
||||||
|
{
|
||||||
|
FOREACH_COMPONENT(beginTraverseClassTemplateSpecializationDecl(D));
|
||||||
|
|
||||||
|
bool ShouldVisitChildren = true;
|
||||||
|
bool ReturnValue = true;
|
||||||
|
if (ReturnValue && !shouldTraversePostOrder())
|
||||||
|
{
|
||||||
|
if (!WalkUpFromClassTemplateSpecializationDecl(D))
|
||||||
|
{
|
||||||
|
ReturnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReturnValue)
|
||||||
|
{
|
||||||
|
if (clang::TypeSourceInfo *TSI = D->getTypeAsWritten())
|
||||||
|
{
|
||||||
|
clang::TypeLoc::TypeLocClass ccccc = TSI->getTypeLoc().getTypeLocClass();
|
||||||
|
const clang::TemplateSpecializationTypeLoc tstl = TSI->getTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>();
|
||||||
|
if (!tstl.isNull())
|
||||||
|
{
|
||||||
|
for (unsigned I = 0, E = tstl.getNumArgs(); I != E; ++I)
|
||||||
|
{
|
||||||
|
if (!TraverseTemplateArgumentLoc(tstl.getArgLoc(I)))
|
||||||
|
{
|
||||||
|
ReturnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReturnValue)
|
||||||
|
{
|
||||||
|
if (!TraverseNestedNameSpecifierLoc(D->getQualifierLoc()))
|
||||||
|
{
|
||||||
|
ReturnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReturnValue && ShouldVisitChildren)
|
||||||
|
{
|
||||||
|
traverseDeclContextHelper(clang::dyn_cast<clang::DeclContext>(D));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReturnValue && shouldTraversePostOrder())
|
||||||
|
{
|
||||||
|
if (!WalkUpFromClassTemplateSpecializationDecl(D))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FOREACH_COMPONENT(endTraverseClassTemplateSpecializationDecl(D));
|
||||||
|
|
||||||
|
return ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_TRAVERSE_TYPE_PTR(ClassTemplatePartialSpecializationDecl, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(ClassTemplatePartialSpecializationDecl, {}, {})
|
||||||
DEF_TRAVERSE_TYPE_PTR(DeclRefExpr, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(DeclRefExpr, {}, {})
|
||||||
DEF_TRAVERSE_TYPE_PTR(CXXForRangeStmt, {}, {})
|
DEF_TRAVERSE_TYPE_PTR(CXXForRangeStmt, {}, {})
|
||||||
|
|||||||
@@ -3508,8 +3508,7 @@ public:
|
|||||||
"};\n"
|
"};\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(client->typeUses.size(), 2); // TODO: this should be 1, so fix the bug where explicit specialization records a typeuse on self
|
TS_ASSERT_EQUALS(client->typeUses.size(), 1);
|
||||||
// TODO: FIXME: type uses: L"A<1> -> A<1> <6:7 6:7>"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_cxx_parser_finds_no_template_argument_for_builtin_non_type_bool_template_parameter_of_explicit_template_specialization()
|
void test_cxx_parser_finds_no_template_argument_for_builtin_non_type_bool_template_parameter_of_explicit_template_specialization()
|
||||||
@@ -3525,7 +3524,7 @@ public:
|
|||||||
"};\n"
|
"};\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(client->typeUses.size(), 2); // TODO: this should be 1, so fix the bug where explicit specialization records a typeuse on self
|
TS_ASSERT_EQUALS(client->typeUses.size(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_cxx_parser_finds_non_type_custom_pointer_template_argument_of_explicit_template_specialization()
|
void test_cxx_parser_finds_non_type_custom_pointer_template_argument_of_explicit_template_specialization()
|
||||||
|
|||||||
Reference in New Issue
Block a user