aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/InterpBuiltin.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-25 07:17:10 +0100
committerGitHub <noreply@github.com>2025-03-25 07:17:10 +0100
commitbcedb368e317332d99dbdde617ebc35140b10de3 (patch)
treeb5f857c35f150071499c9a2f07636b613102260c /clang/lib/AST/ByteCode/InterpBuiltin.cpp
parent1e2ad6793ac205607e7c809283cf69e1cc36a69a (diff)
downloadllvm-bcedb368e317332d99dbdde617ebc35140b10de3.zip
llvm-bcedb368e317332d99dbdde617ebc35140b10de3.tar.gz
llvm-bcedb368e317332d99dbdde617ebc35140b10de3.tar.bz2
[clang][bytecode] Support composite arrays in memcpy op (#132775)
See the attached test case.
Diffstat (limited to 'clang/lib/AST/ByteCode/InterpBuiltin.cpp')
-rw-r--r--clang/lib/AST/ByteCode/InterpBuiltin.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 285ea71..d7de4c0 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2769,6 +2769,18 @@ static bool copyComposite(InterpState &S, CodePtr OpPC, const Pointer &Src,
return true;
}
+ if (DestDesc->isCompositeArray()) {
+ assert(SrcDesc->isCompositeArray());
+ assert(SrcDesc->getNumElems() == DestDesc->getNumElems());
+ for (unsigned I = 0, N = DestDesc->getNumElems(); I != N; ++I) {
+ const Pointer &SrcElem = Src.atIndex(I).narrow();
+ Pointer DestElem = Dest.atIndex(I).narrow();
+ if (!copyComposite(S, OpPC, SrcElem, DestElem, Activate))
+ return false;
+ }
+ return true;
+ }
+
if (DestDesc->isRecord())
return copyRecord(S, OpPC, Src, Dest, Activate);
return Invalid(S, OpPC);