diff --git a/serializer.cc b/serializer.cc index d0d56e25..872f2d10 100644 --- a/serializer.cc +++ b/serializer.cc @@ -24,6 +24,15 @@ void Reflect(Writer& visitor, std::string& value) { } +// ReflectMember +void ReflectMember(Writer& visitor, const char* name, std::string& value) { + if (value.empty()) + return; + visitor.Key(name); + Reflect(visitor, value); +} + + // Location void Reflect(Reader& visitor, Location& value) { value = Location(visitor.GetString()); diff --git a/serializer.h b/serializer.h index a15274b0..ffb9e63b 100644 --- a/serializer.h +++ b/serializer.h @@ -110,6 +110,7 @@ void ReflectMember(Writer& visitor, const char* name, optional& value) { visitor.Key(name); Reflect(visitor, value); } +void ReflectMember(Writer& visitor, const char* name, std::string& value); // Reader: template diff --git a/tests/declaration_vs_definition/func.cc b/tests/declaration_vs_definition/func.cc index 67719ffd..b3d05bc4 100644 --- a/tests/declaration_vs_definition/func.cc +++ b/tests/declaration_vs_definition/func.cc @@ -7,7 +7,6 @@ void foo(); // Note: we always use the latest seen ("most local") definition/declaration. OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@foo#", diff --git a/tests/declaration_vs_definition/method.cc b/tests/declaration_vs_definition/method.cc index d00fa106..cedcbe7a 100644 --- a/tests/declaration_vs_definition/method.cc +++ b/tests/declaration_vs_definition/method.cc @@ -43,7 +43,6 @@ OUTPUT: "definition": "1:7:11", "declaring_type": 0, "uses": ["1:4:8", "1:7:11"] - }], - "vars": [] + }] } */ diff --git a/tests/function_declaration.cc b/tests/function_declaration.cc index 24505a8e..4b64c4a4 100644 --- a/tests/function_declaration.cc +++ b/tests/function_declaration.cc @@ -3,7 +3,6 @@ void foo(int a, int b); /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@foo#I#I#", diff --git a/tests/function_declaration_definition.cc b/tests/function_declaration_definition.cc index 875ddb1f..03bd87fe 100644 --- a/tests/function_declaration_definition.cc +++ b/tests/function_declaration_definition.cc @@ -5,7 +5,6 @@ void foo() {} /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@foo#", diff --git a/tests/function_definition.cc b/tests/function_definition.cc index 76e2700d..f733eda7 100644 --- a/tests/function_definition.cc +++ b/tests/function_definition.cc @@ -3,7 +3,6 @@ void foo() {} /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@foo#", diff --git a/tests/namespaces/method_definition.cc b/tests/namespaces/method_definition.cc index 8b06252d..5e64fdec 100644 --- a/tests/namespaces/method_definition.cc +++ b/tests/namespaces/method_definition.cc @@ -27,7 +27,6 @@ OUTPUT: "definition": "1:6:11", "declaring_type": 0, "uses": ["1:3:8", "1:6:11"] - }], - "vars": [] + }] } */ diff --git a/tests/namespaces/method_inline_declaration.cc b/tests/namespaces/method_inline_declaration.cc index e54aa6ee..fe77aea2 100644 --- a/tests/namespaces/method_inline_declaration.cc +++ b/tests/namespaces/method_inline_declaration.cc @@ -16,7 +16,7 @@ OUTPUT: "funcs": [0], "uses": ["*1:2:7"] }], - "functions": [{ + "funcs": [{ "id": 0, "usr": "c:@N@hello@S@Foo@F@foo#", "short_name": "foo", diff --git a/tests/namespaces/namespace_reference.cc b/tests/namespaces/namespace_reference.cc index 2e370faf..bf751054 100644 --- a/tests/namespaces/namespace_reference.cc +++ b/tests/namespaces/namespace_reference.cc @@ -29,7 +29,7 @@ OUTPUT: "callees": ["0@1:7:7", "0@1:9:3"], "uses": ["1:6:6"] }], - "variables": [{ + "vars": [{ "id": 0, "usr": "c:@N@ns@Foo", "short_name": "Foo", diff --git a/tests/templates/namespace_template_type_usage_folded_into_one.cc b/tests/templates/namespace_template_type_usage_folded_into_one.cc index 20ef7d97..0fd1f743 100644 --- a/tests/templates/namespace_template_type_usage_folded_into_one.cc +++ b/tests/templates/namespace_template_type_usage_folded_into_one.cc @@ -17,7 +17,6 @@ OUTPUT: "definition": "1:3:9", "uses": ["*1:3:9", "*1:5:3", "*1:6:3"] }], - "funcs": [], "vars": [{ "id": 0, "usr": "c:@N@ns@a", diff --git a/tests/templates/template_func_usage_folded_into_one.cc b/tests/templates/template_func_usage_folded_into_one.cc index 721882cd..25336125 100644 --- a/tests/templates/template_func_usage_folded_into_one.cc +++ b/tests/templates/template_func_usage_folded_into_one.cc @@ -12,7 +12,6 @@ int b = foo(); /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:template_func_usage_folded_into_one.cc@FT@>1#Tfoo#I#", diff --git a/tests/usage/func_usage_forward_decl_func.cc b/tests/usage/func_usage_forward_decl_func.cc index d301fe03..e9e46995 100644 --- a/tests/usage/func_usage_forward_decl_func.cc +++ b/tests/usage/func_usage_forward_decl_func.cc @@ -6,7 +6,6 @@ void usage() { /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@foo#", diff --git a/tests/usage/type_usage_various.cc b/tests/usage/type_usage_various.cc index 2961f12e..b702ad40 100644 --- a/tests/usage/type_usage_various.cc +++ b/tests/usage/type_usage_various.cc @@ -33,7 +33,7 @@ OUTPUT: }], "vars": [{ "id": 0, - "usr": "c:type_usage_various.cc@58@S@Foo@F@make#@f", + "usr": "c:type_usage_various.cc@57@S@Foo@F@make#@f", "short_name": "f", "qualified_name": "f", "definition": "1:6:7", diff --git a/tests/usage/var_usage_call_function.cc b/tests/usage/var_usage_call_function.cc index cc850e72..954a479a 100644 --- a/tests/usage/var_usage_call_function.cc +++ b/tests/usage/var_usage_call_function.cc @@ -10,7 +10,6 @@ void caller() { /* OUTPUT: { - "types": [], "funcs": [{ "id": 0, "usr": "c:@F@called#",