Skip to content

Commit

Permalink
Merged master:b198de67e0b into amd-gfx:6357d679802
Browse files Browse the repository at this point in the history
Local branch amd-gfx 6357d67 Merged master:1c7037a2a55 into amd-gfx:f3c1125efa9
Remote branch master b198de6 Merge some of the PCH object support with modular codegen
  • Loading branch information
Sw authored and Sw committed Jul 22, 2020
2 parents 6357d67 + b198de6 commit c1fd4c1
Show file tree
Hide file tree
Showing 98 changed files with 783 additions and 473 deletions.
4 changes: 0 additions & 4 deletions clang-tools-extra/clangd/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ if(CLANG_BUILT_STANDALONE)
endif()
endif()

if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
add_definitions("-Wno-suggest-override")
endif()

if (CLANGD_ENABLE_REMOTE)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
Expand Down
4 changes: 0 additions & 4 deletions clang-tools-extra/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ function(add_extra_unittest test_dirname)
add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
endfunction()

if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
add_definitions("-Wno-suggest-override")
endif()

add_subdirectory(clang-apply-replacements)
add_subdirectory(clang-change-namespace)
add_subdirectory(clang-doc)
Expand Down
2 changes: 1 addition & 1 deletion clang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)

if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
Expand Down
4 changes: 0 additions & 4 deletions clang/include/clang/AST/ExternalASTSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
/// Retrieve the module that corresponds to the given module ID.
virtual Module *getModule(unsigned ID) { return nullptr; }

/// Determine whether D comes from a PCH which was built with a corresponding
/// object file.
virtual bool DeclIsFromPCHWithObjectFile(const Decl *D) { return false; }

/// Return a descriptor for the corresponding module, if one exists.
virtual llvm::Optional<ASTSourceDescriptor> getSourceDescriptor(unsigned ID);

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/BuiltinsPPC.def
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ BUILTIN(__builtin_vsx_xxsldwi, "v.", "t")

BUILTIN(__builtin_vsx_xxeval, "V2ULLiV2ULLiV2ULLiV2ULLiIi", "")

BUILTIN(__builtin_vsx_xvtlsbb, "iV16Ucb", "")
BUILTIN(__builtin_vsx_xvtlsbb, "iV16UcUi", "")

// P10 Vector Permute Extended built-in.
BUILTIN(__builtin_vsx_xxpermx, "V16UcV16UcV16UcV16UcIi", "")
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Sema/MultiplexExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ class MultiplexExternalSemaSource : public ExternalSemaSource {
/// Retrieve the module that corresponds to the given module ID.
Module *getModule(unsigned ID) override;

bool DeclIsFromPCHWithObjectFile(const Decl *D) override;

/// Perform layout on the given record.
///
/// This routine allows the external AST source to provide an specific
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2085,8 +2085,6 @@ class ASTReader
/// Note: overrides method in ExternalASTSource
Module *getModule(unsigned ID) override;

bool DeclIsFromPCHWithObjectFile(const Decl *D) override;

/// Retrieve the module file with a given local ID within the specified
/// ModuleFile.
ModuleFile *getLocalModuleFile(ModuleFile &M, unsigned ID);
Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Serialization/ModuleFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ class ModuleFile {
/// Whether timestamps are included in this module file.
bool HasTimestamps = false;

/// Whether the PCH has a corresponding object file.
bool PCHHasObjectFile = false;

/// Whether the top-level module has been read from the AST file.
bool DidReadTopLevelSubmodule = false;

Expand Down
31 changes: 0 additions & 31 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10473,37 +10473,6 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
else
return false;

if (D->isFromASTFile() && !LangOpts.BuildingPCHWithObjectFile) {
assert(getExternalSource() && "It's from an AST file; must have a source.");
// On Windows, PCH files are built together with an object file. If this
// declaration comes from such a PCH and DeclMustBeEmitted would return
// true, it would have returned true and the decl would have been emitted
// into that object file, so it doesn't need to be emitted here.
// Note that decls are still emitted if they're referenced, as usual;
// DeclMustBeEmitted is used to decide whether a decl must be emitted even
// if it's not referenced.
//
// Explicit template instantiation definitions are tricky. If there was an
// explicit template instantiation decl in the PCH before, it will look like
// the definition comes from there, even if that was just the declaration.
// (Explicit instantiation defs of variable templates always get emitted.)
bool IsExpInstDef =
isa<FunctionDecl>(D) &&
cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
TSK_ExplicitInstantiationDefinition;

// Implicit member function definitions, such as operator= might not be
// marked as template specializations, since they're not coming from a
// template but synthesized directly on the class.
IsExpInstDef |=
isa<CXXMethodDecl>(D) &&
cast<CXXMethodDecl>(D)->getParent()->getTemplateSpecializationKind() ==
TSK_ExplicitInstantiationDefinition;

if (getExternalSource()->DeclIsFromPCHWithObjectFile(D) && !IsExpInstDef)
return false;
}

// If this is a member of a class template, we do not need to emit it.
if (D->getDeclContext()->isDependentContext())
return false;
Expand Down
7 changes: 0 additions & 7 deletions clang/lib/Sema/MultiplexExternalSemaSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,6 @@ Module *MultiplexExternalSemaSource::getModule(unsigned ID) {
return nullptr;
}

bool MultiplexExternalSemaSource::DeclIsFromPCHWithObjectFile(const Decl *D) {
for (auto *S : Sources)
if (S->DeclIsFromPCHWithObjectFile(D))
return true;
return false;
}

bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record,
uint64_t &Size,
uint64_t &Alignment,
Expand Down
9 changes: 1 addition & 8 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2747,7 +2747,7 @@ ASTReader::ReadControlBlock(ModuleFile &F,
return VersionMismatch;
}

bool hasErrors = Record[7];
bool hasErrors = Record[6];
if (hasErrors && !DisableValidation && !AllowASTWithCompilerErrors) {
Diag(diag::err_pch_with_compiler_errors);
return HadErrors;
Expand All @@ -2765,8 +2765,6 @@ ASTReader::ReadControlBlock(ModuleFile &F,

F.HasTimestamps = Record[5];

F.PCHHasObjectFile = Record[6];

const std::string &CurBranch = getClangFullRepositoryVersion();
StringRef ASTBranch = Blob;
if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
Expand Down Expand Up @@ -8590,11 +8588,6 @@ Module *ASTReader::getModule(unsigned ID) {
return getSubmodule(ID);
}

bool ASTReader::DeclIsFromPCHWithObjectFile(const Decl *D) {
ModuleFile *MF = getOwningModuleFile(D);
return MF && MF->PCHHasObjectFile;
}

ModuleFile *ASTReader::getLocalModuleFile(ModuleFile &F, unsigned ID) {
if (ID & 1) {
// It's a module, look it up by submodule ID.
Expand Down
21 changes: 9 additions & 12 deletions clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,9 @@ uint64_t ASTDeclReader::GetCurrentCursorOffset() {

void ASTDeclReader::ReadFunctionDefinition(FunctionDecl *FD) {
if (Record.readInt()) {
Reader.DefinitionSource[FD] = Loc.F->Kind == ModuleKind::MK_MainFile;
if (Reader.getContext().getLangOpts().BuildingPCHWithObjectFile &&
Reader.DeclIsFromPCHWithObjectFile(FD))
Reader.DefinitionSource[FD] = true;
Reader.DefinitionSource[FD] =
Loc.F->Kind == ModuleKind::MK_MainFile ||
Reader.getContext().getLangOpts().BuildingPCHWithObjectFile;
}
if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
CD->setNumCtorInitializers(Record.readInt());
Expand Down Expand Up @@ -1436,10 +1435,9 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
}

if (VD->getStorageDuration() == SD_Static && Record.readInt()) {
Reader.DefinitionSource[VD] = Loc.F->Kind == ModuleKind::MK_MainFile;
if (Reader.getContext().getLangOpts().BuildingPCHWithObjectFile &&
Reader.DeclIsFromPCHWithObjectFile(VD))
Reader.DefinitionSource[VD] = true;
Reader.DefinitionSource[VD] =
Loc.F->Kind == ModuleKind::MK_MainFile ||
Reader.getContext().getLangOpts().BuildingPCHWithObjectFile;
}

enum VarKind {
Expand Down Expand Up @@ -1700,10 +1698,9 @@ void ASTDeclReader::ReadCXXDefinitionData(
Data.HasODRHash = true;

if (Record.readInt()) {
Reader.DefinitionSource[D] = Loc.F->Kind == ModuleKind::MK_MainFile;
if (Reader.getContext().getLangOpts().BuildingPCHWithObjectFile &&
Reader.DeclIsFromPCHWithObjectFile(D))
Reader.DefinitionSource[D] = true;
Reader.DefinitionSource[D] =
Loc.F->Kind == ModuleKind::MK_MainFile ||
Reader.getContext().getLangOpts().BuildingPCHWithObjectFile;
}

Data.NumBases = Record.readInt();
Expand Down
2 changes: 0 additions & 2 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,6 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Clang min.
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Relocatable
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Timestamps
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PCHHasObjectFile
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Errors
MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // SVN branch/tag
unsigned MetadataAbbrevCode = Stream.EmitAbbrev(std::move(MetadataAbbrev));
Expand All @@ -1134,7 +1133,6 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
CLANG_VERSION_MINOR,
!isysroot.empty(),
IncludeTimestamps,
Context.getLangOpts().BuildingPCHWithObjectFile,
ASTHasCompilerErrors};
Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
getClangFullRepositoryVersion());
Expand Down
11 changes: 8 additions & 3 deletions clang/lib/Serialization/ASTWriterDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,10 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
// that module interface unit, not by its users. (Inline variables are
// still emitted in module users.)
ModulesCodegen =
(Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
(Writer.WritingModule->Kind == Module::ModuleInterfaceUnit ||
(D->hasAttr<DLLExportAttr>() &&
Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal;
}
Record.push_back(ModulesCodegen);
if (ModulesCodegen)
Expand Down Expand Up @@ -2469,7 +2471,10 @@ void ASTRecordWriter::AddFunctionDefinition(const FunctionDecl *FD) {
Linkage = Writer->Context->GetGVALinkageForFunction(FD);
ModulesCodegen = *Linkage == GVA_StrongExternal;
}
if (Writer->Context->getLangOpts().ModulesCodegen) {
if (Writer->Context->getLangOpts().ModulesCodegen ||
(FD->hasAttr<DLLExportAttr>() &&
Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {

// Under -fmodules-codegen, codegen is performed for all non-internal,
// non-always_inline functions, unless they are available elsewhere.
if (!FD->hasAttr<AlwaysInlineAttr>()) {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/builtins-ppc-p10vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,13 @@ vector float test_vec_vec_splati_ins_f(void) {
}

int test_vec_test_lsbb_all_ones(void) {
// CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 true
// CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 1
// CHECK-NEXT: ret i32
return vec_test_lsbb_all_ones(vuca);
}

int test_vec_test_lsbb_all_zeros(void) {
// CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 false
// CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 0
// CHECK-NEXT: ret i32
return vec_test_lsbb_all_zeros(vuca);
}
16 changes: 12 additions & 4 deletions clang/test/CodeGen/pch-dllexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCH %s

// Build PCH with object file, then use it.
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -building-pch-with-obj -o - %s | FileCheck -check-prefix=OBJ %s
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ %s
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -building-pch-with-obj -o - %s | FileCheck -check-prefix=OBJ %s
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ -check-prefix=PCHWITHOBJ-O1 %s

// Check for vars separately to avoid having to reorder the check statements.
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJVARS %s

// Test the PCHWITHOBJ at -O0 where available_externally definitions are not
// provided:
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ -check-prefix=PCHWITHOBJ-O0 %s
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJVARS %s


#ifndef IN_HEADER
#define IN_HEADER

Expand All @@ -23,7 +30,8 @@ inline void __declspec(dllexport) foo() {}
inline void __declspec(dllexport) baz() {}
// OBJ: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
// PCH: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
// PCHWITHOBJ: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
// PCHWITHOBJ-O1: define available_externally dso_local void @"?baz@@YAXXZ"
// PCHWITHOBJ-O0-NOT: define {{.*}}"?baz@@YAXXZ"


struct __declspec(dllexport) S {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(exec C)

cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)

include(CheckCCompilerFlag)
check_c_compiler_flag("-std=c99" C99_SUPPORTED)
Expand Down
4 changes: 0 additions & 4 deletions clang/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ if(CLANG_BUILT_STANDALONE)
endif()
endif()

if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
add_definitions("-Wno-suggest-override")
endif()

# add_clang_unittest(test_dirname file1.cpp file2.cpp)
#
# Will compile the list of files together and link against the clang
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# An important constraint of the build is that it only produces libraries
# based on the ability of the host toolchain to target various platforms.

cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)

if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
Expand Down
1 change: 0 additions & 1 deletion compiler-rt/cmake/Modules/AddCompilerRT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ set(COMPILER_RT_GMOCK_CFLAGS

append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS)

if(MSVC)
# gtest use a lot of stuff marked as deprecated on Windows.
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)
project(custom-libcxx C CXX)

# Build static libcxxabi.
Expand Down
1 change: 0 additions & 1 deletion compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRT
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
check_cxx_compiler_flag("-Werror -Wsuggest-override" COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)

check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# architecture-specific code in various subdirectories.

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)

project(CompilerRTBuiltins C ASM)
set(COMPILER_RT_STANDALONE_BUILD TRUE)
Expand Down
2 changes: 1 addition & 1 deletion flang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9.0)
cmake_minimum_required(VERSION 3.13.4)

# RPATH settings on macOS do not affect INSTALL_NAME.
if (POLICY CMP0068)
Expand Down
31 changes: 19 additions & 12 deletions flang/lib/Evaluate/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,26 @@ std::size_t Constant<Type<TypeCategory::Character, KIND>>::CopyFrom(
std::size_t count, ConstantSubscripts &resultSubscripts,
const std::vector<int> *dimOrder) {
CHECK(length_ == source.length_);
std::size_t copied{0};
std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
ConstantSubscripts sourceSubscripts{source.lbounds()};
while (copied < count) {
auto *dest{&values_.at(SubscriptsToOffset(resultSubscripts) * length_)};
const auto *src{&source.values_.at(
source.SubscriptsToOffset(sourceSubscripts) * length_)};
std::memcpy(dest, src, elementBytes);
copied++;
source.IncrementSubscripts(sourceSubscripts);
IncrementSubscripts(resultSubscripts, dimOrder);
if (length_ == 0) {
// It's possible that the array of strings consists of all empty strings.
// If so, constant folding will result in a string that's completely empty
// and the length_ will be zero, and there's nothing to do.
return count;
} else {
std::size_t copied{0};
std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
ConstantSubscripts sourceSubscripts{source.lbounds()};
while (copied < count) {
auto *dest{&values_.at(SubscriptsToOffset(resultSubscripts) * length_)};
const auto *src{&source.values_.at(
source.SubscriptsToOffset(sourceSubscripts) * length_)};
std::memcpy(dest, src, elementBytes);
copied++;
source.IncrementSubscripts(sourceSubscripts);
IncrementSubscripts(resultSubscripts, dimOrder);
}
return copied;
}
return copied;
}

// Constant<SomeDerived> specialization
Expand Down
Loading

0 comments on commit c1fd4c1

Please sign in to comment.