ClangASTType
GetOrCreateStructForIdentifier (const ConstString &type_name,
- const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields);
+ const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields,
+ bool packed = false);
//------------------------------------------------------------------
// Structure, Unions, Classes
void
BuildIndirectFields ();
+ void
+ SetIsPacked ();
+
clang::VarDecl *
AddVariableToRecordType (const char *name,
const ClangASTType &var_type,
ClangASTType
ClangASTContext::GetOrCreateStructForIdentifier (const ConstString &type_name,
- const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields)
+ const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields,
+ bool packed)
{
ClangASTType type;
if ((type = GetTypeForIdentifier<clang::CXXRecordDecl>(type_name)).IsValid())
type.StartTagDeclarationDefinition();
for (const auto& field : type_fields)
type.AddFieldToRecordType(field.first, field.second, lldb::eAccessPublic, 0);
+ if (packed)
+ type.SetIsPacked();
type.CompleteTagDeclarationDefinition();
return type;
}
}
}
+void
+ClangASTType::SetIsPacked ()
+{
+ clang::RecordDecl *record_decl = GetAsRecordDecl();
+
+ if (!record_decl)
+ return;
+
+ record_decl->addAttr(clang::PackedAttr::CreateImplicit(*m_ast));
+}
+
clang::VarDecl *
ClangASTType::AddVariableToRecordType (const char *name,
const ClangASTType &var_type,