diff --git a/src/indexer.cc b/src/indexer.cc index 0f90c737..54c5a2f3 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -518,7 +518,8 @@ CXIdxClientFile OnIndexIncludedFile(CXClientData client_data, IndexInclude include; include.line = line; include.resolved_path = FileName(file->file); - db->includes.push_back(include); + if (!include.resolved_path.empty()) + db->includes.push_back(include); return nullptr; } diff --git a/src/test.cc b/src/test.cc index d1a11aa0..2be751ae 100644 --- a/src/test.cc +++ b/src/test.cc @@ -120,7 +120,7 @@ void RunIndexTests() { float memory_after = -1.; { - // if (path != "tests/constructors/make_functions.cc") continue; + // if (path != "tests/stl.cc") continue; Config config; FileConsumer::SharedState file_consumer_shared; @@ -129,7 +129,9 @@ void RunIndexTests() { // std::cout << "[START] " << path << std::endl; PerformanceImportFile perf; std::vector> dbs = - Parse(&config, &file_consumer_shared, path, {"-xc++", "-std=c++11"}, + Parse(&config, &file_consumer_shared, path, + {"-xc++", "-std=c++11", + "-resource-dir=" + GetDefaultResourceDirectory()}, {}, &perf, &index, false /*dump_ast*/); // Parse expected output from the test, parse it into JSON document. diff --git a/tests/lambdas/lambda.cc b/tests/lambdas/lambda.cc index 591374e8..9cd8e13b 100644 --- a/tests/lambdas/lambda.cc +++ b/tests/lambdas/lambda.cc @@ -81,7 +81,7 @@ OUTPUT: "short_name": "y", "detailed_name": "int y", "definition_spelling": "4:31-4:32", - "definition_extent": "4:31-4:32", + "definition_extent": "4:27-4:32", "is_local": false, "is_macro": false, "uses": ["4:31-4:32", "6:7-6:8"] diff --git a/tests/macros/complex.cc b/tests/macros/complex.cc index 1a48103d..b6e220aa 100644 --- a/tests/macros/complex.cc +++ b/tests/macros/complex.cc @@ -63,7 +63,7 @@ OUTPUT: "id": 1, "usr": "c:complex.cc@8@macro@FOO", "short_name": "FOO", - "detailed_name": "FOO", + "detailed_name": "#define FOO(aaa, bbb)\n int a();\n int a() { return aaa + bbb; }", "definition_spelling": "1:9-1:12", "definition_extent": "1:9-3:32", "is_local": false, diff --git a/tests/macros/foo.cc b/tests/macros/foo.cc index 7c551804..8be3582c 100644 --- a/tests/macros/foo.cc +++ b/tests/macros/foo.cc @@ -56,7 +56,7 @@ OUTPUT: "id": 1, "usr": "c:foo.cc@8@macro@A", "short_name": "A", - "detailed_name": "A", + "detailed_name": "#define A 5", "definition_spelling": "1:9-1:10", "definition_extent": "1:9-1:12", "is_local": false, @@ -66,7 +66,7 @@ OUTPUT: "id": 2, "usr": "c:foo.cc@21@macro@DISALLOW", "short_name": "DISALLOW", - "detailed_name": "DISALLOW", + "detailed_name": "#define DISALLOW(type) type(type&&) = delete;", "definition_spelling": "2:9-2:17", "definition_extent": "2:9-2:46", "is_local": false, diff --git a/tests/preprocessor/include_guard.cc b/tests/preprocessor/include_guard.cc index fcf69d64..8e5c5746 100644 --- a/tests/preprocessor/include_guard.cc +++ b/tests/preprocessor/include_guard.cc @@ -14,7 +14,7 @@ OUTPUT: "id": 0, "usr": "c:include_guard.cc@21@macro@FOO", "short_name": "FOO", - "detailed_name": "FOO", + "detailed_name": "#define FOO", "definition_spelling": "2:9-2:12", "definition_extent": "2:9-2:12", "is_local": false, diff --git a/tests/stl.cc b/tests/stl.cc index 24aa021c..0e25d30c 100644 --- a/tests/stl.cc +++ b/tests/stl.cc @@ -176,13 +176,13 @@ OUTPUT: "resolved_path": "&signal.h" }, { "line": 14, - "resolved_path": "&" + "resolved_path": "&stdalign.h" }, { "line": 15, "resolved_path": "&stdarg.h" }, { "line": 16, - "resolved_path": "&" + "resolved_path": "&stdatomic.h" }, { "line": 17, "resolved_path": "&stdbool.h" @@ -200,16 +200,13 @@ OUTPUT: "resolved_path": "&stdlib.h" }, { "line": 22, - "resolved_path": "&" + "resolved_path": "&stdnoreturn.h" }, { "line": 23, "resolved_path": "&string.h" }, { "line": 24, - "resolved_path": "&" - }, { - "line": 25, - "resolved_path": "&" + "resolved_path": "&tgmath.h" }, { "line": 26, "resolved_path": "&time.h" @@ -345,9 +342,6 @@ OUTPUT: }, { "line": 72, "resolved_path": "&scoped_allocator" - }, { - "line": 73, - "resolved_path": "&" }, { "line": 74, "resolved_path": "&climits" @@ -435,9 +429,6 @@ OUTPUT: }, { "line": 102, "resolved_path": "&algorithm" - }, { - "line": 103, - "resolved_path": "&" }, { "line": 104, "resolved_path": "&iterator" diff --git a/tests/usage/func_called_from_macro_argument.cc b/tests/usage/func_called_from_macro_argument.cc index 5b2d7024..b29d92cd 100644 --- a/tests/usage/func_called_from_macro_argument.cc +++ b/tests/usage/func_called_from_macro_argument.cc @@ -46,7 +46,7 @@ OUTPUT: "id": 0, "usr": "c:func_called_from_macro_argument.cc@8@macro@MACRO_CALL", "short_name": "MACRO_CALL", - "detailed_name": "MACRO_CALL", + "detailed_name": "#define MACRO_CALL(e) e", "definition_spelling": "1:9-1:19", "definition_extent": "1:9-1:24", "is_local": false,