logic: improved c++ indexer coverage

* revised check for visiting a referenced type or decl
* calling client->onFileParsed everytime a file gets processed by the Preprocessor so we can create valid locations in that file
* created test for detecting a usage of a member inside a CallExpression context
* added method to consume a context based reference kind in the AstVisitor
This commit is contained in:
malte_langkabel
2016-11-10 16:39:52 +01:00
parent cf8e8c7655
commit 9aed97eee2
7 changed files with 108 additions and 33 deletions
+19 -1
View File
@@ -14,7 +14,7 @@
class CxxParserTestSuite: public CxxTest::TestSuite
{
public:
void test_cxx_parser_usage_of_field_in_function_call_arguments()
void test_cxx_parser_finds_usage_of_field_in_function_call_arguments()
{
std::shared_ptr<TestParserClient> client = parseCode(
"class A\n"
@@ -32,6 +32,24 @@ public:
TS_ASSERT_EQUALS(client->usages[0], "void A::foo(int) -> A::bar <6:7 6:9>");
}
void test_cxx_parser_usage_of_field_in_function_call_context()
{
std::shared_ptr<TestParserClient> client = parseCode(
"class A\n"
"{\n"
"public:\n"
" void foo(int i)\n"
" {\n"
" a->foo(6);\n"
" }\n"
" A* a;\n"
"};\n"
);
TS_ASSERT_EQUALS(client->usages.size(), 1);
TS_ASSERT_EQUALS(client->usages[0], "void A::foo(int) -> A::a <6:3 6:3>");
}
///////////////////////////////////////////////////////////////////////////////
// test finding symbol definitions and declarations