Skip to content

Commit

Permalink
RemoveIgnored: Set names for removed members to AddPadding::MemberPrefix
Browse files Browse the repository at this point in the history
This means they will be treated as padding, so CodeGen will not try to
store any data for them.
  • Loading branch information
ajor committed Jul 12, 2023
1 parent e7549db commit 3e8464e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ workflows:
- build-gcc
oid_test_args: "-ftype-graph"
tests_regex: "OidIntegration\\..*"
exclude_regex: ".*inheritance_polymorphic.*|.*pointers_incomplete_containing_struct|.*ignored_a|.*arrays_member_int0"
exclude_regex: ".*inheritance_polymorphic.*|.*pointers_incomplete_containing_struct|.*arrays_member_int0"
- test:
name: test-typed-data-segment-gcc
requires:
- build-gcc
oid_test_args: "-ftyped-data-segment"
tests_regex: "OidIntegration\\..*"
exclude_regex: ".*inheritance_polymorphic.*|.*pointers.*|.*ignored_a|.*arrays_member_int0|.*cycles_.*"
exclude_regex: ".*inheritance_polymorphic.*|.*pointers.*|.*arrays_member_int0|.*cycles_.*"
- coverage:
name: coverage
requires:
Expand Down
3 changes: 2 additions & 1 deletion oi/type_graph/RemoveIgnored.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
#include "RemoveIgnored.h"

#include "AddPadding.h"
#include "TypeGraph.h"

namespace type_graph {
Expand Down Expand Up @@ -48,7 +49,7 @@ void RemoveIgnored::visit(Class& c) {
auto& paddingArray =
typeGraph_.makeType<Array>(primitive, c.members[i].type().size());
c.members[i] =
Member{paddingArray, c.members[i].name, c.members[i].bitOffset};
Member{paddingArray, AddPadding::MemberPrefix, c.members[i].bitOffset};
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/test_remove_ignored.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST(RemoveIgnoredTest, Match) {
[0] Class: ClassA (size: 12)
Member: a (offset: 0)
[1] Class: ClassB (size: 4)
Member: b (offset: 4)
Member: __oi_padding (offset: 4)
[2] Array: (length: 4)
Primitive: int8_t
Member: c (offset: 8)
Expand Down

0 comments on commit 3e8464e

Please sign in to comment.