diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-07 11:16:04 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-07 11:16:04 +0000 |
commit | ac5eabb0b9b9fd998d631c4cd1d944f12d9b3a68 (patch) | |
tree | f1b63670804bb4adb36b42be07d3b811fdf1ba0f /clang/lib/CodeGen | |
parent | 1e2b7e667216ec4efceceeb77b681197b17a233d (diff) | |
download | bcm5719-llvm-ac5eabb0b9b9fd998d631c4cd1d944f12d9b3a68.tar.gz bcm5719-llvm-ac5eabb0b9b9fd998d631c4cd1d944f12d9b3a68.zip |
[OPENMP] Fixed capturing of VLA variables.
After some changes in codegen capturing of VLA variables in OpenMP regions was broken, causing compiler crash. Patch fixes this issue.
llvm-svn: 286103
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 11 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 74c552583c4..a5eee2e4120 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2127,12 +2127,11 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { if (auto *FD = LambdaCaptureFields.lookup(VD)) return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue); else if (CapturedStmtInfo) { - auto it = LocalDeclMap.find(VD); - if (it != LocalDeclMap.end()) { - if (auto RefTy = VD->getType()->getAs<ReferenceType>()) { - return EmitLoadOfReferenceLValue(it->second, RefTy); - } - return MakeAddrLValue(it->second, T); + auto I = LocalDeclMap.find(VD); + if (I != LocalDeclMap.end()) { + if (auto RefTy = VD->getType()->getAs<ReferenceType>()) + return EmitLoadOfReferenceLValue(I->second, RefTy); + return MakeAddrLValue(I->second, T); } LValue CapLVal = EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD), diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index b09d8c8807d..4dd12ea3df0 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -307,7 +307,7 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) { if (ArgLVal.getType()->isLValueReferenceType()) { ArgAddr = EmitLoadOfReference( ArgAddr, ArgLVal.getType()->castAs<ReferenceType>()); - } else { + } else if (!VarTy->isVariablyModifiedType() || !VarTy->isPointerType()) { assert(ArgLVal.getType()->isPointerType()); ArgAddr = EmitLoadOfPointer( ArgAddr, ArgLVal.getType()->castAs<PointerType>()); |