summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-05-20 03:46:04 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-05-20 03:46:04 +0000
commit16dc7b68c4d90cd3abac7015c27030f3d6c710f9 (patch)
tree88c7090be664baa4ac9b397a65a20821304d4e8c /clang/lib/Sema
parent1f294fd934c17ec9836cbde8293d3c51974cdb05 (diff)
downloadbcm5719-llvm-16dc7b68c4d90cd3abac7015c27030f3d6c710f9.tar.gz
bcm5719-llvm-16dc7b68c4d90cd3abac7015c27030f3d6c710f9.zip
Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes: <total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested). If simple copying is requested, size is calculated like: <total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType). memcpy() is used with this calculated size of the VLA. Differential Revision: http://reviews.llvm.org/D9851 llvm-svn: 237768
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 126d6fa60f8..c7d0c148ba0 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -1286,7 +1286,8 @@ StmtResult Sema::ActOnOpenMPRegionEnd(StmtResult S,
}
// This is required for proper codegen.
for (auto *Clause : Clauses) {
- if (isOpenMPPrivate(Clause->getClauseKind())) {
+ if (isOpenMPPrivate(Clause->getClauseKind()) ||
+ Clause->getClauseKind() == OMPC_copyprivate) {
// Mark all variables in private list clauses as used in inner region.
for (auto *VarRef : Clause->children()) {
if (auto *E = cast_or_null<Expr>(VarRef)) {
OpenPOWER on IntegriCloud