diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2018-10-02 01:00:44 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-10-02 01:00:44 +0000 |
| commit | 9d34307788056d8be15863697e1b7ec7ec3f204e (patch) | |
| tree | 75a0ef7efc185a4cc36aa58cd5474b7cc1d2e54a /clang/lib/CodeGen | |
| parent | 31fddbac8fa7ca0f18b6781a05346b447a607c4f (diff) | |
| download | bcm5719-llvm-9d34307788056d8be15863697e1b7ec7ec3f204e.tar.gz bcm5719-llvm-9d34307788056d8be15863697e1b7ec7ec3f204e.zip | |
[CodeGen] Before entering the loop that copies a non-trivial array field
of a non-trivial C struct, copy the preceding trivial fields that
haven't been copied.
This commit fixes a bug where the instructions used to copy the
preceding trivial fields were emitted inside the loop body.
rdar://problem/44185064
llvm-svn: 343556
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGNonTrivialStruct.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGNonTrivialStruct.cpp b/clang/lib/CodeGen/CGNonTrivialStruct.cpp index e9f60a9113c..d44d156997a 100644 --- a/clang/lib/CodeGen/CGNonTrivialStruct.cpp +++ b/clang/lib/CodeGen/CGNonTrivialStruct.cpp @@ -187,6 +187,7 @@ template <class Derived> struct GenFuncNameBase { if (!FK) return asDerived().visitTrivial(QualType(AT, 0), FD, CurStructOffset); + asDerived().flushTrivialFields(); CharUnits FieldOffset = CurStructOffset + asDerived().getFieldOffset(FD); ASTContext &Ctx = asDerived().getContext(); const ConstantArrayType *CAT = cast<ConstantArrayType>(AT); @@ -336,6 +337,7 @@ template <class Derived> struct GenFuncBase { return asDerived().visitTrivial(QualType(AT, 0), FD, CurStackOffset, Addrs); + asDerived().flushTrivialFields(Addrs); CodeGenFunction &CGF = *this->CGF; ASTContext &Ctx = CGF.getContext(); |

