File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -99,22 +99,20 @@ bool TreeVisitor::VisitRecordDecl(clang::RecordDecl *record) {
99
99
}
100
100
101
101
void TreeVisitor::handleUnion (clang::RecordDecl *record, std::string name) {
102
- uint64_t maxSize = 0 ;
103
-
104
102
std::vector<std::shared_ptr<Field>> fields;
105
103
106
104
for (const clang::FieldDecl *field : record->fields ()) {
107
- uint64_t sizeInBits = astContext->getTypeSize (field->getType ());
108
- assert (sizeInBits % 8 == 0 );
109
- maxSize = std::max (maxSize, sizeInBits / 8 );
110
105
std::string fname = field->getNameAsString ();
111
106
std::shared_ptr<Type> ftype =
112
107
typeTranslator.translate (field->getType (), &name);
113
108
114
109
fields.push_back (std::make_shared<Field>(fname, ftype));
115
110
}
116
111
117
- ir.addUnion (name, std::move (fields), maxSize, getLocation (record));
112
+ uint64_t sizeInBits = astContext->getTypeSize (record->getTypeForDecl ());
113
+ assert (sizeInBits % 8 == 0 );
114
+
115
+ ir.addUnion (name, std::move (fields), sizeInBits / 8 , getLocation (record));
118
116
}
119
117
120
118
void TreeVisitor::handleStruct (clang::RecordDecl *record, std::string name) {
You can’t perform that action at this time.
0 commit comments