Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -3281,7 +3281,7 @@ llvm::dyn_cast( (clang::Decl *)imported_decl.GetOpaqueDecl())) decl = - m_ast.CreateUsingDeclaration(decl_context, 0, clang_imported_decl); + m_ast.CreateUsingDeclaration(decl_context, clang_imported_decl); } } break; @@ -3300,7 +3300,7 @@ if (clang::NamespaceDecl *ns_decl = TypeSystemClang::DeclContextGetAsNamespaceDecl( imported_decl_ctx)) - decl = m_ast.CreateUsingDirectiveDeclaration(decl_context, 0, ns_decl); + decl = m_ast.CreateUsingDirectiveDeclaration(decl_context, ns_decl); } } break; Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -389,7 +389,7 @@ clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, - unsigned owning_module, bool is_inline = false); + bool is_inline = false); // Function Types @@ -983,11 +983,9 @@ clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx, - unsigned owning_module, clang::NamespaceDecl *ns_decl); clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, - unsigned owning_module, clang::NamedDecl *target); clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context, Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -1261,9 +1261,11 @@ // complete definition just in case. bool has_name = !name.empty(); - CXXRecordDecl *decl = CXXRecordDecl::Create( - ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(), - SourceLocation(), has_name ? &ast.Idents.get(name) : nullptr); + CXXRecordDecl *decl = CXXRecordDecl::CreateDeserialized(ast, 0); + decl->setTagKind((TagDecl::TagKind)kind); + decl->setDeclContext(decl_ctx); + if (has_name) + decl->setDeclName(&ast.Idents.get(name)); SetOwningModule(decl, owning_module); if (!has_name) { @@ -1385,9 +1387,11 @@ llvm::SmallVector template_param_decls; TemplateParameterList *template_param_list = CreateTemplateParameterList( ast, template_param_infos, template_param_decls); - FunctionTemplateDecl *func_tmpl_decl = FunctionTemplateDecl::Create( - ast, decl_ctx, func_decl->getLocation(), func_decl->getDeclName(), - template_param_list, func_decl); + FunctionTemplateDecl *func_tmpl_decl = + FunctionTemplateDecl::CreateDeserialized(ast, 0); + func_tmpl_decl->setDeclContext(decl_ctx); + func_tmpl_decl->setDeclName(func_decl->getDeclName()); + func_tmpl_decl->init(func_decl, template_param_list); SetOwningModule(func_tmpl_decl, owning_module); for (size_t i = 0, template_param_decl_count = template_param_decls.size(); @@ -1440,11 +1444,11 @@ TemplateParameterList *template_param_list = CreateTemplateParameterList( ast, template_param_infos, template_param_decls); - CXXRecordDecl *template_cxx_decl = CXXRecordDecl::Create( - ast, (TagDecl::TagKind)kind, - decl_ctx, // What decl context do we use here? TU? The actual - // decl context? - SourceLocation(), SourceLocation(), &identifier_info); + CXXRecordDecl *template_cxx_decl = CXXRecordDecl::CreateDeserialized(ast, 0); + template_cxx_decl->setTagKind((TagDecl::TagKind)kind); + // What decl context do we use here? TU? The actual decl context? + template_cxx_decl->setDeclContext(decl_ctx); + template_cxx_decl->setDeclName(decl_name); SetOwningModule(template_cxx_decl, owning_module); for (size_t i = 0, template_param_decl_count = template_param_decls.size(); @@ -1457,11 +1461,11 @@ // template_cxx_decl->startDefinition(); // template_cxx_decl->completeDefinition(); - class_template_decl = ClassTemplateDecl::Create( - ast, - decl_ctx, // What decl context do we use here? TU? The actual - // decl context? - SourceLocation(), decl_name, template_param_list, template_cxx_decl); + class_template_decl = ClassTemplateDecl::CreateDeserialized(ast, 0); + // What decl context do we use here? TU? The actual decl context? + class_template_decl->setDeclContext(decl_ctx); + class_template_decl->setDeclName(decl_name); + class_template_decl->init(template_cxx_decl, template_param_list); template_cxx_decl->setDescribedClassTemplate(class_template_decl); SetOwningModule(class_template_decl, owning_module); @@ -1517,9 +1521,14 @@ ast, template_param_infos.packed_args->args); } ClassTemplateSpecializationDecl *class_template_specialization_decl = - ClassTemplateSpecializationDecl::Create( - ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(), - SourceLocation(), class_template_decl, args, nullptr); + ClassTemplateSpecializationDecl::CreateDeserialized( + ast, 0); + class_template_specialization_decl->setTagKind((TagDecl::TagKind)kind); + class_template_specialization_decl->setDeclContext(decl_ctx); + class_template_specialization_decl->setInstantiationOf(class_template_decl); + class_template_specialization_decl->setTemplateArgs( + TemplateArgumentList::CreateCopy(ast, args)); + SetOwningModule(class_template_decl, owning_module); class_template_specialization_decl->setSpecializationKind( @@ -1650,11 +1659,10 @@ if (!decl_ctx) decl_ctx = ast.getTranslationUnitDecl(); - ObjCInterfaceDecl *decl = ObjCInterfaceDecl::Create( - ast, decl_ctx, SourceLocation(), &ast.Idents.get(name), nullptr, nullptr, - SourceLocation(), - /*isForwardDecl,*/ - isInternal); + ObjCInterfaceDecl *decl = ObjCInterfaceDecl::CreateDeserialized(ast, 0); + decl->setDeclContext(decl_ctx); + decl->setDeclName(&ast.Idents.get(name)); + decl->setImplicit(isInternal); SetOwningModule(decl, owning_module); if (decl && metadata) @@ -1693,8 +1701,7 @@ #pragma mark Namespace Declarations NamespaceDecl *TypeSystemClang::GetUniqueNamespaceDeclaration( - const char *name, clang::DeclContext *decl_ctx, unsigned owning_module, - bool is_inline) { + const char *name, clang::DeclContext *decl_ctx, bool is_inline) { NamespaceDecl *namespace_decl = nullptr; ASTContext &ast = getASTContext(); TranslationUnitDecl *translation_unit_decl = ast.getTranslationUnitDecl(); @@ -1748,8 +1755,6 @@ } } } - // Note: namespaces can span multiple modules, so perhaps this isn't a good idea. - SetOwningModule(namespace_decl, owning_module); VerifyDecl(namespace_decl); return namespace_decl; @@ -1759,8 +1764,9 @@ TypeSystemClang::CreateBlockDeclaration(clang::DeclContext *ctx, unsigned owning_module) { if (ctx) { - clang::BlockDecl *decl = clang::BlockDecl::Create( - getASTContext(), ctx, clang::SourceLocation()); + clang::BlockDecl *decl = + clang::BlockDecl::CreateDeserialized(getASTContext(), 0); + decl->setDeclContext(ctx); ctx->addDecl(decl); SetOwningModule(decl, owning_module); return decl; @@ -1786,19 +1792,16 @@ } clang::UsingDirectiveDecl *TypeSystemClang::CreateUsingDirectiveDeclaration( - clang::DeclContext *decl_ctx, unsigned owning_module, - clang::NamespaceDecl *ns_decl) { + clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl) { if (decl_ctx && ns_decl) { auto *translation_unit = getASTContext().getTranslationUnitDecl(); - clang::UsingDirectiveDecl *using_decl = clang::UsingDirectiveDecl::Create( + clang::UsingDirectiveDecl *using_decl = clang::UsingDirectiveDecl::Create( getASTContext(), decl_ctx, clang::SourceLocation(), clang::SourceLocation(), clang::NestedNameSpecifierLoc(), clang::SourceLocation(), ns_decl, FindLCABetweenDecls(decl_ctx, ns_decl, translation_unit)); decl_ctx->addDecl(using_decl); - SetOwningModule(using_decl, owning_module); - return using_decl; } return nullptr; @@ -1806,17 +1809,14 @@ clang::UsingDecl * TypeSystemClang::CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, - unsigned owning_module, clang::NamedDecl *target) { if (current_decl_ctx && target) { clang::UsingDecl *using_decl = clang::UsingDecl::Create( getASTContext(), current_decl_ctx, clang::SourceLocation(), clang::NestedNameSpecifierLoc(), clang::DeclarationNameInfo(), false); - SetOwningModule(using_decl, owning_module); clang::UsingShadowDecl *shadow_decl = clang::UsingShadowDecl::Create( getASTContext(), current_decl_ctx, clang::SourceLocation(), using_decl, target); - SetOwningModule(shadow_decl, owning_module); using_decl->addShadowDecl(shadow_decl); current_decl_ctx->addDecl(using_decl); return using_decl; @@ -1828,11 +1828,12 @@ clang::DeclContext *decl_context, unsigned owning_module, const char *name, clang::QualType type) { if (decl_context) { - clang::VarDecl *var_decl = clang::VarDecl::Create( - getASTContext(), decl_context, clang::SourceLocation(), - clang::SourceLocation(), - name && name[0] ? &getASTContext().Idents.getOwn(name) : nullptr, type, - nullptr, clang::SC_None); + clang::VarDecl *var_decl = + clang::VarDecl::CreateDeserialized(getASTContext(), 0); + var_decl->setDeclContext(decl_context); + if (name && name[0]) + var_decl->setDeclName(&getASTContext().Idents.getOwn(name)); + var_decl->setType(type); SetOwningModule(var_decl, owning_module); var_decl->setAccess(clang::AS_public); @@ -1958,11 +1959,15 @@ clang::DeclarationName declarationName = GetDeclarationName(name, function_clang_type); - func_decl = FunctionDecl::Create( - ast, decl_ctx, SourceLocation(), SourceLocation(), declarationName, - ClangUtil::GetQualType(function_clang_type), nullptr, - (clang::StorageClass)storage, is_inline, hasWrittenPrototype, - isConstexprSpecified ? CSK_constexpr : CSK_unspecified); + func_decl = FunctionDecl::CreateDeserialized(ast, 0); + func_decl->setDeclContext(decl_ctx); + func_decl->setDeclName(declarationName); + func_decl->setType(ClangUtil::GetQualType(function_clang_type)); + func_decl->setStorageClass((clang::StorageClass)storage); + func_decl->setInlineSpecified(is_inline); + func_decl->setHasWrittenPrototype(hasWrittenPrototype); + func_decl->setConstexprKind(isConstexprSpecified ? CSK_constexpr + : CSK_unspecified); SetOwningModule(func_decl, owning_module); if (func_decl) decl_ctx->addDecl(func_decl); @@ -2015,11 +2020,12 @@ clang::DeclContext *decl_ctx, unsigned owning_module, const char *name, const CompilerType ¶m_type, int storage, bool add_decl) { ASTContext &ast = getASTContext(); - auto *decl = - ParmVarDecl::Create(ast, decl_ctx, SourceLocation(), SourceLocation(), - name && name[0] ? &ast.Idents.get(name) : nullptr, - ClangUtil::GetQualType(param_type), nullptr, - (clang::StorageClass)storage, nullptr); + auto *decl = ParmVarDecl::CreateDeserialized(ast, 0); + decl->setDeclContext(decl_ctx); + if (name && name[0]) + decl->setDeclName(&ast.Idents.get(name)); + decl->setType(ClangUtil::GetQualType(param_type)); + decl->setStorageClass((clang::StorageClass)storage); SetOwningModule(decl, owning_module); if (add_decl) @@ -2120,12 +2126,13 @@ // TODO: ask about these... // const bool IsFixed = false; - EnumDecl *enum_decl = EnumDecl::Create( - ast, decl_ctx, SourceLocation(), SourceLocation(), - name && name[0] ? &ast.Idents.get(name) : nullptr, nullptr, - is_scoped, // IsScoped - is_scoped, // IsScopedUsingClassTag - false); // TODO: IsFixed + EnumDecl *enum_decl = EnumDecl::CreateDeserialized(ast, 0); + enum_decl->setDeclContext(decl_ctx); + if (name && name[0]) + enum_decl->setDeclName(&ast.Idents.get(name)); + enum_decl->setScoped(is_scoped); + enum_decl->setScopedUsingClassTag(is_scoped); + enum_decl->setFixed(false); SetOwningModule(enum_decl, owning_module); if (enum_decl) { if (decl_ctx) @@ -4321,10 +4328,11 @@ if (!decl_ctx) decl_ctx = ast->getASTContext().getTranslationUnitDecl(); - clang::TypedefDecl *decl = clang::TypedefDecl::Create( - clang_ast, decl_ctx, clang::SourceLocation(), - clang::SourceLocation(), &clang_ast.Idents.get(typedef_name), - clang_ast.getTrivialTypeSourceInfo(qual_type)); + clang::TypedefDecl *decl = + clang::TypedefDecl::CreateDeserialized(clang_ast, 0); + decl->setDeclContext(decl_ctx); + decl->setDeclName(&clang_ast.Idents.get(typedef_name)); + decl->setTypeSourceInfo(clang_ast.getTrivialTypeSourceInfo(qual_type)); SetOwningModule(decl, TypePayloadClang(payload).GetOwningModuleID()); decl->setAccess(clang::AS_public); // TODO respect proper access specifier @@ -4427,10 +4435,11 @@ if (!decl_ctx) decl_ctx = getASTContext().getTranslationUnitDecl(); - clang::TypedefDecl *decl = clang::TypedefDecl::Create( - clang_ast, decl_ctx, clang::SourceLocation(), clang::SourceLocation(), - &clang_ast.Idents.get(typedef_name), - clang_ast.getTrivialTypeSourceInfo(qual_type)); + clang::TypedefDecl *decl = + clang::TypedefDecl::CreateDeserialized(clang_ast, 0); + decl->setDeclContext(decl_ctx); + decl->setDeclName(&clang_ast.Idents.get(typedef_name)); + decl->setTypeSourceInfo(clang_ast.getTrivialTypeSourceInfo(qual_type)); SetOwningModule(decl, TypePayloadClang(payload).GetOwningModuleID()); clang::TagDecl *tdecl = nullptr; @@ -6981,15 +6990,12 @@ clang::RecordDecl *record_decl = ast->GetAsRecordDecl(type); if (record_decl) { - field = clang::FieldDecl::Create( - clang_ast, record_decl, clang::SourceLocation(), - clang::SourceLocation(), - ident, // Identifier - ClangUtil::GetQualType(field_clang_type), // Field type - nullptr, // TInfo * - bit_width, // BitWidth - false, // Mutable - clang::ICIS_NoInit); // HasInit + field = clang::FieldDecl::CreateDeserialized(clang_ast, 0); + field->setDeclContext(record_decl); + field->setDeclName(ident); + field->setType(ClangUtil::GetQualType(field_clang_type)); + if (bit_width) + field->setBitWidth(bit_width); SetMemberOwningModule(field, record_decl); if (name.empty()) { @@ -7023,14 +7029,15 @@ field_clang_type.GetCompleteType(); - field = clang::ObjCIvarDecl::Create( - clang_ast, class_interface_decl, clang::SourceLocation(), - clang::SourceLocation(), - ident, // Identifier - ClangUtil::GetQualType(field_clang_type), // Field type - nullptr, // TypeSourceInfo * - ConvertAccessTypeToObjCIvarAccessControl(access), bit_width, - is_synthesized); + auto ivar = clang::ObjCIvarDecl::CreateDeserialized(clang_ast, 0); + ivar->setDeclContext(class_interface_decl); + ivar->setDeclName(ident); + ivar->setType(ClangUtil::GetQualType(field_clang_type)); + ivar->setAccessControl(ConvertAccessTypeToObjCIvarAccessControl(access)); + if (bit_width) + ivar->setBitWidth(bit_width); + ivar->setSynthesize(is_synthesized); + field = ivar; SetMemberOwningModule(field, class_interface_decl); if (field) { @@ -7093,7 +7100,6 @@ ast->getASTContext(), record_decl, clang::SourceLocation(), nested_field_decl->getIdentifier(), nested_field_decl->getType(), {chain, 2}); - SetMemberOwningModule(indirect_field, record_decl); indirect_field->setImplicit(); @@ -7124,7 +7130,6 @@ nested_indirect_field_decl->getIdentifier(), nested_indirect_field_decl->getType(), {chain, nested_chain_size + 1}); - SetMemberOwningModule(indirect_field, record_decl); indirect_field->setImplicit(); @@ -7186,15 +7191,11 @@ if (!name.empty()) ident = &ast->getASTContext().Idents.get(name); - var_decl = clang::VarDecl::Create( - ast->getASTContext(), // ASTContext & - record_decl, // DeclContext * - clang::SourceLocation(), // clang::SourceLocation StartLoc - clang::SourceLocation(), // clang::SourceLocation IdLoc - ident, // clang::IdentifierInfo * - ClangUtil::GetQualType(var_type), // Variable clang::QualType - nullptr, // TypeSourceInfo * - clang::SC_Static); // StorageClass + var_decl = clang::VarDecl::CreateDeserialized(ast->getASTContext(), 0); + var_decl->setDeclContext(record_decl); + var_decl->setDeclName(ident); + var_decl->setType(ClangUtil::GetQualType(var_type)); + var_decl->setStorageClass(clang::SC_Static); SetMemberOwningModule(var_decl, record_decl); if (!var_decl) return nullptr; @@ -7250,30 +7251,29 @@ if (is_artificial) return nullptr; // skip everything artificial - const clang::ExplicitSpecifier explicit_spec( - nullptr /*expr*/, is_explicit - ? clang::ExplicitSpecKind::ResolvedTrue - : clang::ExplicitSpecKind::ResolvedFalse); if (name.startswith("~")) { - cxx_dtor_decl = clang::CXXDestructorDecl::Create( - getASTContext(), cxx_record_decl, clang::SourceLocation(), - clang::DeclarationNameInfo( - getASTContext().DeclarationNames.getCXXDestructorName( - getASTContext().getCanonicalType(record_qual_type)), - clang::SourceLocation()), - method_qual_type, nullptr, is_inline, is_artificial, - ConstexprSpecKind::CSK_unspecified); + cxx_dtor_decl = + clang::CXXDestructorDecl::CreateDeserialized(getASTContext(), 0); + cxx_dtor_decl->setDeclContext(cxx_record_decl); + cxx_dtor_decl->setDeclName( + getASTContext().DeclarationNames.getCXXDestructorName( + getASTContext().getCanonicalType(record_qual_type))); + cxx_dtor_decl->setType(method_qual_type); + cxx_dtor_decl->setImplicit(is_artificial); + cxx_dtor_decl->setInlineSpecified(is_inline); + cxx_dtor_decl->setConstexprKind(CSK_unspecified); cxx_method_decl = cxx_dtor_decl; } else if (decl_name == cxx_record_decl->getDeclName()) { - cxx_ctor_decl = clang::CXXConstructorDecl::Create( - getASTContext(), cxx_record_decl, clang::SourceLocation(), - clang::DeclarationNameInfo( - getASTContext().DeclarationNames.getCXXConstructorName( - getASTContext().getCanonicalType(record_qual_type)), - clang::SourceLocation()), - method_qual_type, - nullptr, // TypeSourceInfo * - explicit_spec, is_inline, is_artificial, CSK_unspecified); + cxx_ctor_decl = clang::CXXConstructorDecl::CreateDeserialized( + getASTContext(), 0, is_explicit ? 1 << 1 : 0); + cxx_ctor_decl->setDeclContext(cxx_record_decl); + cxx_ctor_decl->setDeclName( + getASTContext().DeclarationNames.getCXXConstructorName( + getASTContext().getCanonicalType(record_qual_type))); + cxx_ctor_decl->setType(method_qual_type); + cxx_ctor_decl->setImplicit(is_artificial); + cxx_ctor_decl->setInlineSpecified(is_inline); + cxx_ctor_decl->setConstexprKind(CSK_unspecified); cxx_method_decl = cxx_ctor_decl; } else { clang::StorageClass SC = is_static ? clang::SC_Static : clang::SC_None; @@ -7289,36 +7289,46 @@ if (!TypeSystemClang::CheckOverloadedOperatorKindParameterCount( is_method, op_kind, num_params)) return nullptr; - cxx_method_decl = clang::CXXMethodDecl::Create( - getASTContext(), cxx_record_decl, clang::SourceLocation(), - clang::DeclarationNameInfo( - getASTContext().DeclarationNames.getCXXOperatorName(op_kind), - clang::SourceLocation()), - method_qual_type, - nullptr, // TypeSourceInfo * - SC, is_inline, CSK_unspecified, clang::SourceLocation()); + cxx_method_decl = + clang::CXXMethodDecl::CreateDeserialized(getASTContext(), 0); + cxx_method_decl->setDeclContext(cxx_record_decl); + cxx_method_decl->setDeclName( + getASTContext().DeclarationNames.getCXXOperatorName(op_kind)); + cxx_method_decl->setType(method_qual_type); + cxx_method_decl->setStorageClass(SC); + cxx_method_decl->setInlineSpecified(is_inline); + cxx_method_decl->setConstexprKind(CSK_unspecified); } else if (num_params == 0) { + const clang::ExplicitSpecifier explicit_spec( + nullptr /*expr*/, is_explicit + ? clang::ExplicitSpecKind::ResolvedTrue + : clang::ExplicitSpecKind::ResolvedFalse); + // Conversion operators don't take params... - cxx_method_decl = clang::CXXConversionDecl::Create( - getASTContext(), cxx_record_decl, clang::SourceLocation(), - clang::DeclarationNameInfo( - getASTContext().DeclarationNames.getCXXConversionFunctionName( - getASTContext().getCanonicalType( - function_type->getReturnType())), - clang::SourceLocation()), - method_qual_type, - nullptr, // TypeSourceInfo * - is_inline, explicit_spec, CSK_unspecified, clang::SourceLocation()); + auto *cxx_conversion_decl = + clang::CXXConversionDecl::CreateDeserialized(getASTContext(), 0); + cxx_conversion_decl->setDeclContext(cxx_record_decl); + cxx_conversion_decl->setDeclName( + getASTContext().DeclarationNames.getCXXConversionFunctionName( + getASTContext().getCanonicalType( + function_type->getReturnType()))); + cxx_conversion_decl->setType(method_qual_type); + cxx_conversion_decl->setInlineSpecified(is_inline); + cxx_conversion_decl->setExplicitSpecifier(explicit_spec); + cxx_conversion_decl->setConstexprKind(CSK_unspecified); + cxx_method_decl = cxx_conversion_decl; } } if (cxx_method_decl == nullptr) { - cxx_method_decl = clang::CXXMethodDecl::Create( - getASTContext(), cxx_record_decl, clang::SourceLocation(), - clang::DeclarationNameInfo(decl_name, clang::SourceLocation()), - method_qual_type, - nullptr, // TypeSourceInfo * - SC, is_inline, CSK_unspecified, clang::SourceLocation()); + cxx_method_decl = + clang::CXXMethodDecl::CreateDeserialized(getASTContext(), 0); + cxx_method_decl->setDeclContext(cxx_record_decl); + cxx_method_decl->setDeclName(decl_name); + cxx_method_decl->setType(method_qual_type); + cxx_method_decl->setInlineSpecified(is_inline); + cxx_method_decl->setStorageClass(SC); + cxx_method_decl->setConstexprKind(CSK_unspecified); } } SetMemberOwningModule(cxx_method_decl, cxx_record_decl); @@ -7488,15 +7498,14 @@ prop_type_source = clang_ast.getTrivialTypeSourceInfo( ClangUtil::GetQualType(property_clang_type)); - clang::ObjCPropertyDecl *property_decl = clang::ObjCPropertyDecl::Create( - clang_ast, class_interface_decl, - clang::SourceLocation(), // Source Location - &clang_ast.Idents.get(property_name), - clang::SourceLocation(), // Source Location for AT - clang::SourceLocation(), // Source location for ( - ivar_decl ? ivar_decl->getType() - : ClangUtil::GetQualType(property_clang_type), - prop_type_source); + clang::ObjCPropertyDecl *property_decl = + clang::ObjCPropertyDecl::CreateDeserialized(clang_ast, 0); + property_decl->setDeclContext(class_interface_decl); + property_decl->setDeclName(&clang_ast.Idents.get(property_name)); + property_decl->setType(ivar_decl + ? ivar_decl->getType() + : ClangUtil::GetQualType(property_clang_type), + prop_type_source); SetMemberOwningModule(property_decl, class_interface_decl); if (!property_decl) @@ -7577,12 +7586,18 @@ clang::ObjCMethodDecl::None; const bool HasRelatedResultType = false; - getter = clang::ObjCMethodDecl::Create( - clang_ast, clang::SourceLocation(), clang::SourceLocation(), getter_sel, - ClangUtil::GetQualType(property_clang_type_to_access), nullptr, - class_interface_decl, isInstance, isVariadic, isPropertyAccessor, - isSynthesizedAccessorStub, isImplicitlyDeclared, isDefined, impControl, - HasRelatedResultType); + getter = clang::ObjCMethodDecl::CreateDeserialized(clang_ast, 0); + getter->setDeclName(getter_sel); + getter->setReturnType(ClangUtil::GetQualType(property_clang_type_to_access)); + getter->setDeclContext(class_interface_decl); + getter->setInstanceMethod(isInstance); + getter->setVariadic(isVariadic); + getter->setPropertyAccessor(isPropertyAccessor); + getter->setSynthesizedAccessorStub(isSynthesizedAccessorStub); + getter->setImplicit(isImplicitlyDeclared); + getter->setDefined(isDefined); + getter->setDeclImplementation(impControl); + getter->setRelatedResultType(HasRelatedResultType); SetMemberOwningModule(getter, class_interface_decl); if (getter) { @@ -7613,12 +7628,19 @@ clang::ObjCMethodDecl::None; const bool HasRelatedResultType = false; - setter = clang::ObjCMethodDecl::Create( - clang_ast, clang::SourceLocation(), clang::SourceLocation(), setter_sel, - result_type, nullptr, class_interface_decl, isInstance, isVariadic, - isPropertyAccessor, isSynthesizedAccessorStub, isImplicitlyDeclared, - isDefined, impControl, HasRelatedResultType); - SetMemberOwningModule(setter, class_interface_decl); + setter = clang::ObjCMethodDecl::CreateDeserialized(clang_ast, 0); + setter->setDeclName(setter_sel); + setter->setReturnType(result_type); + setter->setDeclContext(class_interface_decl); + setter->setInstanceMethod(isInstance); + setter->setVariadic(isVariadic); + setter->setPropertyAccessor(isPropertyAccessor); + setter->setSynthesizedAccessorStub(isSynthesizedAccessorStub); + setter->setImplicit(isImplicitlyDeclared); + setter->setDefined(isDefined); + setter->setDeclImplementation(impControl); + setter->setRelatedResultType(HasRelatedResultType); + SetMemberOwningModule(setter, class_interface_decl); if (setter) { if (metadata) @@ -7734,15 +7756,19 @@ return nullptr; // some debug information is corrupt. We are not going to // deal with it. - clang::ObjCMethodDecl *objc_method_decl = clang::ObjCMethodDecl::Create( - ast, - clang::SourceLocation(), // beginLoc, - clang::SourceLocation(), // endLoc, - method_selector, method_function_prototype->getReturnType(), - nullptr, // TypeSourceInfo *ResultTInfo, - lldb_ast->GetDeclContextForType(ClangUtil::GetQualType(type)), isInstance, - isVariadic, isPropertyAccessor, isSynthesizedAccessorStub, - isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType); + auto *objc_method_decl = clang::ObjCMethodDecl::CreateDeserialized(ast, 0); + objc_method_decl->setDeclName(method_selector); + objc_method_decl->setReturnType(method_function_prototype->getReturnType()); + objc_method_decl->setDeclContext( + lldb_ast->GetDeclContextForType(ClangUtil::GetQualType(type))); + objc_method_decl->setInstanceMethod(isInstance); + objc_method_decl->setVariadic(isVariadic); + objc_method_decl->setPropertyAccessor(isPropertyAccessor); + objc_method_decl->setSynthesizedAccessorStub(isSynthesizedAccessorStub); + objc_method_decl->setImplicit(isImplicitlyDeclared); + objc_method_decl->setDefined(isDefined); + objc_method_decl->setDeclImplementation(impControl); + objc_method_decl->setRelatedResultType(HasRelatedResultType); SetMemberOwningModule(objc_method_decl, class_interface_decl); if (objc_method_decl == nullptr) @@ -7967,10 +7993,13 @@ if (!enutype) return nullptr; - clang::EnumConstantDecl *enumerator_decl = clang::EnumConstantDecl::Create( - getASTContext(), enutype->getDecl(), clang::SourceLocation(), - name ? &getASTContext().Idents.get(name) : nullptr, // Identifier - clang::QualType(enutype, 0), nullptr, value); + clang::EnumConstantDecl *enumerator_decl = + clang::EnumConstantDecl::CreateDeserialized(getASTContext(), 0); + enumerator_decl->setDeclContext(enutype->getDecl()); + if (name) + enumerator_decl->setDeclName(&getASTContext().Idents.get(name)); + enumerator_decl->setType(clang::QualType(enutype, 0)); + enumerator_decl->setInitVal(value); SetMemberOwningModule(enumerator_decl, enutype->getDecl()); if (!enumerator_decl)