logic: add storage transformation to merge anonymous types and the respective typedef

* moved storage related classes to data/storage folder
* implemented recording c++ unions as NODE_UNION instead of just using NODE_TYPE
* added transformation to merge anonymous classes/structs/enums/unions and typedef nodes
* added tests for this transformation
* added setting for enabling/disabling this transformation
This commit is contained in:
malte_langkabel
2017-07-18 15:14:43 +02:00
parent e536f20e36
commit cad595a32c
76 changed files with 524 additions and 96 deletions
+17 -1
View File
@@ -292,6 +292,21 @@ public:
TS_ASSERT_DIFFERS(utility::substrBeforeLast(client->fields[0], '<'), utility::substrBeforeLast(client->fields[1], '<'));
}
void test_cxx_parser_finds_anonymous_union_declaration()
{
std::shared_ptr<TestParserClient> client = parseCode(
"typedef union\n"
"{\n"
" int i;\n"
" float f;\n"
"} Foo;\n"
);
TS_ASSERT(utility::containsElement<std::string>(
client->unions, "anonymous union (input.cc<1:9>) <1:9 <1:9 1:13> 5:1>"
));
}
void test_cxx_parser_finds_enum_defined_in_global_namespace()
{
std::shared_ptr<TestParserClient> client = parseCode(
@@ -3325,7 +3340,8 @@ public:
"c++1z",
std::vector<FilePath>(),
std::vector<FilePath>(),
std::vector<std::string>()
std::vector<std::string>(),
false
);
std::shared_ptr<TestParserClient> client = std::make_shared<TestParserClient>();