logic: fixed recording of Cxx field usage
* fixed recording reference to field inside TemporaryObjectExpr as usage edge instead of call edge
This commit is contained in:
@@ -113,7 +113,7 @@ void CxxAstVisitorComponentDeclRefKind::beginTraverseConstructorInitializer(clan
|
||||
void CxxAstVisitorComponentDeclRefKind::beginTraverseCXXTemporaryObjectExpr(clang::CXXTemporaryObjectExpr* s)
|
||||
{
|
||||
m_thisRefKind = REFERENCE_CALL;
|
||||
m_childRefKind = REFERENCE_CALL;
|
||||
m_childRefKind = REFERENCE_USAGE;
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentDeclRefKind::visitVarDecl(clang::VarDecl* d)
|
||||
|
||||
@@ -2024,6 +2024,35 @@ public:
|
||||
));
|
||||
}
|
||||
|
||||
void test_cxx_parser_finds_usage_of_member_in_temporary_object_expression()
|
||||
{
|
||||
std::shared_ptr<TestParserClient> client = parseCode(
|
||||
"class Foo\n"
|
||||
"{\n"
|
||||
"public:\n"
|
||||
" Foo() { }\n"
|
||||
" Foo(const Foo& i, int d) { }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class Bar\n"
|
||||
"{\n"
|
||||
"public:\n"
|
||||
" Bar(): m_i() {}\n"
|
||||
"\n"
|
||||
" void baba()\n"
|
||||
" {\n"
|
||||
" Foo(m_i, 4);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const Foo m_i;\n"
|
||||
"};\n"
|
||||
);
|
||||
|
||||
TS_ASSERT(utility::containsElement<std::string>(
|
||||
client->usages, "void Bar::baba() -> const Foo Bar::m_i <15:7 15:9>"
|
||||
));
|
||||
}
|
||||
|
||||
void test_cxx_parser_finds_return_type_use_in_function()
|
||||
{
|
||||
std::shared_ptr<TestParserClient> client = parseCode(
|
||||
|
||||
Reference in New Issue
Block a user