From bbf5c262ab6b4530baa91a7876e49b96dd482ccf Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 9 Mar 2010 12:53:38 +0000 Subject: [PATCH] Replace copy loops with memcpy. llvm-svn: 98055 --- clang/lib/AST/RecordLayout.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clang/lib/AST/RecordLayout.cpp b/clang/lib/AST/RecordLayout.cpp index 9f8bdec94ee6..838753a1433f 100644 --- a/clang/lib/AST/RecordLayout.cpp +++ b/clang/lib/AST/RecordLayout.cpp @@ -32,8 +32,7 @@ ASTRecordLayout::ASTRecordLayout(ASTContext &Ctx, uint64_t size, unsigned alignm FieldCount(fieldcount), CXXInfo(0) { if (FieldCount > 0) { FieldOffsets = new (Ctx) uint64_t[FieldCount]; - for (unsigned i = 0; i < FieldCount; ++i) - FieldOffsets[i] = fieldoffsets[i]; + memcpy(FieldOffsets, fieldoffsets, FieldCount * sizeof(*FieldOffsets)); } } @@ -55,8 +54,7 @@ ASTRecordLayout::ASTRecordLayout(ASTContext &Ctx, { if (FieldCount > 0) { FieldOffsets = new (Ctx) uint64_t[FieldCount]; - for (unsigned i = 0; i < FieldCount; ++i) - FieldOffsets[i] = fieldoffsets[i]; + memcpy(FieldOffsets, fieldoffsets, FieldCount * sizeof(*FieldOffsets)); } CXXInfo->PrimaryBase = PrimaryBase;