Skip to content

Commit

Permalink
Merge pull request #94 from chaoticgd/printbaseclassoffsets
Browse files Browse the repository at this point in the history
Fix a bug where base class offsets were not being printed
  • Loading branch information
chaoticgd authored Feb 4, 2023
2 parents 2a3e87a + cd0abc1 commit edf0b74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ccc/print_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ void print_cpp_ast_node(FILE* out, const ast::Node& node, VariableName& parent_n
if(node.is_volatile) {
fprintf(out, "volatile ");
}
if(node.is_base_class && node.access_specifier != ast::AS_PUBLIC) {
fprintf(out, "%s ", ast::access_specifier_to_string((ast::AccessSpecifier) node.access_specifier));
}

switch(node.descriptor) {
case ast::ARRAY: {
Expand Down Expand Up @@ -257,6 +254,10 @@ void print_cpp_ast_node(FILE* out, const ast::Node& node, VariableName& parent_n
for(size_t i = 0; i < struct_or_union.base_classes.size(); i++) {
ast::Node& base_class = *struct_or_union.base_classes[i].get();
assert(base_class.descriptor == ast::TypeName::DESCRIPTOR);
print_cpp_offset(out, base_class, digits_for_offset);
if( base_class.access_specifier != ast::AS_PUBLIC) {
fprintf(out, "%s ", ast::access_specifier_to_string((ast::AccessSpecifier) base_class.access_specifier));
}
VariableName dummy;
print_cpp_ast_node(out, base_class, dummy, indentation_level + 1, digits_for_offset);
if(i != struct_or_union.base_classes.size() - 1) {
Expand Down

0 comments on commit edf0b74

Please sign in to comment.