forked from OSchip/llvm-project
[lldb][NFC] Rename ClangASTImporter::InsertRecordDecl to SetRecordLayout and document it
This function is just setting the layout for the given RecordDecl so the current name is not very descriptive. Also add some documentation for it.
This commit is contained in:
parent
4becf68c6f
commit
b852b3c982
|
@ -58,7 +58,14 @@ public:
|
|||
clang::Decl *DeportDecl(clang::ASTContext *dst_ctx,
|
||||
clang::ASTContext *src_ctx, clang::Decl *decl);
|
||||
|
||||
void InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout);
|
||||
/// Sets the layout for the given RecordDecl. The layout will later be
|
||||
/// used by Clang's during code generation. Not calling this function for
|
||||
/// a RecordDecl will cause that Clang's codegen tries to layout the
|
||||
/// record by itself.
|
||||
///
|
||||
/// \param decl The RecordDecl to set the layout for.
|
||||
/// \param layout The layout for the record.
|
||||
void SetRecordLayout(clang::RecordDecl *decl, const LayoutInfo &layout);
|
||||
|
||||
bool LayoutRecordType(
|
||||
const clang::RecordDecl *record_decl, uint64_t &bit_size,
|
||||
|
|
|
@ -1720,7 +1720,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
|
|||
ClangASTContext::GetAsRecordDecl(clang_type);
|
||||
|
||||
if (record_decl) {
|
||||
GetClangASTImporter().InsertRecordDecl(
|
||||
GetClangASTImporter().SetRecordLayout(
|
||||
record_decl, ClangASTImporter::LayoutInfo());
|
||||
}
|
||||
}
|
||||
|
@ -2134,7 +2134,7 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
|
|||
clang::CXXRecordDecl *record_decl =
|
||||
m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
|
||||
if (record_decl)
|
||||
GetClangASTImporter().InsertRecordDecl(record_decl, layout_info);
|
||||
GetClangASTImporter().SetRecordLayout(record_decl, layout_info);
|
||||
}
|
||||
|
||||
return (bool)clang_type;
|
||||
|
|
|
@ -231,6 +231,6 @@ void UdtRecordCompleter::complete() {
|
|||
ClangASTContext::CompleteTagDeclarationDefinition(m_derived_ct);
|
||||
|
||||
if (auto *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(&m_tag_decl)) {
|
||||
m_ast_builder.importer().InsertRecordDecl(record_decl, m_layout);
|
||||
m_ast_builder.importer().SetRecordLayout(record_decl, m_layout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1207,7 +1207,7 @@ bool PDBASTParser::CompleteTypeFromUDT(
|
|||
if (!record_decl)
|
||||
return static_cast<bool>(compiler_type);
|
||||
|
||||
GetClangASTImporter().InsertRecordDecl(record_decl, layout_info);
|
||||
GetClangASTImporter().SetRecordLayout(record_decl, layout_info);
|
||||
|
||||
return static_cast<bool>(compiler_type);
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ bool ClangASTImporter::LayoutRecordType(
|
|||
return success;
|
||||
}
|
||||
|
||||
void ClangASTImporter::InsertRecordDecl(clang::RecordDecl *decl,
|
||||
void ClangASTImporter::SetRecordLayout(clang::RecordDecl *decl,
|
||||
const LayoutInfo &layout) {
|
||||
m_record_decl_to_layout_map.insert(std::make_pair(decl, layout));
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ TEST_F(TestClangASTImporter, RecordLayout) {
|
|||
layout_info.bit_size = 15;
|
||||
layout_info.alignment = 2;
|
||||
layout_info.field_offsets[field] = 1;
|
||||
importer.InsertRecordDecl(source_record, layout_info);
|
||||
importer.SetRecordLayout(source_record, layout_info);
|
||||
|
||||
uint64_t bit_size;
|
||||
uint64_t alignment;
|
||||
|
|
Loading…
Reference in New Issue