diff options
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 4a7c779fc7a..8347444b273 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1855,7 +1855,20 @@ ClangASTContext::CreateArrayType (const ClangASTType &element_type, return ClangASTType(); } - +ClangASTType +ClangASTContext::GetOrCreateStructForIdentifier (const ConstString &type_name, + const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields) +{ + ClangASTType type; + if ((type = GetTypeForIdentifier<clang::CXXRecordDecl>(type_name)).IsValid()) + return type; + type = CreateRecordType(nullptr, lldb::eAccessPublic, type_name.GetCString(), clang::TTK_Struct, lldb::eLanguageTypeC); + type.StartTagDeclarationDefinition(); + for (const auto& field : type_fields) + type.AddFieldToRecordType(field.first, field.second, lldb::eAccessPublic, 0); + type.CompleteTagDeclarationDefinition(); + return type; +} #pragma mark Enumeration Types |