Fix the NSPathStore2 data formatter to actually handle the explicit length stored inside the object. The meat of this commit, however, is a nice little API for easily adding new __lldb_autogen_ helper types to an AST context
llvm-svn: 220881
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 4a7c779..8347444 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1855,7 +1855,20 @@
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