Skip to content

Commit

Permalink
Fixed #227: Support bit-fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfertig committed Sep 27, 2019
1 parent 14d7978 commit 78de315
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,11 @@ void CodeGenerator::InsertArg(const FieldDecl* stmt)

mOutputFormatHelper.Append(GetTypeNameAsParameter(stmt->getType(), name));

if(const auto* constantExpr = dyn_cast_or_null<ConstantExpr>(stmt->getBitWidth())) {
mOutputFormatHelper.Append(':');
InsertArg(constantExpr);
}

// Keep the inline init for aggregates, as we do not see it somewhere else.
if(cxxRecordDecl->isAggregate()) {
const auto* initializer = stmt->getInClassInitializer();
Expand Down
5 changes: 5 additions & 0 deletions tests/Issue227.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct Point
{
int x:4;
int y:4;
};
7 changes: 7 additions & 0 deletions tests/Issue227.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
struct Point
{
int x:4;
int y:4;
};


0 comments on commit 78de315

Please sign in to comment.