diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2017-10-06 16:17:25 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-10-06 16:17:25 +0000 |
| commit | cab496d3a9a9f934823960134e5cbbf1db22088a (patch) | |
| tree | d17c81225313f5ba58f29662e296d492198c2a22 /clang/lib/CodeGen/CGExpr.cpp | |
| parent | f52a3b94e15a94b2c07c67cb2f513b00758ed7bc (diff) | |
| download | bcm5719-llvm-cab496d3a9a9f934823960134e5cbbf1db22088a.tar.gz bcm5719-llvm-cab496d3a9a9f934823960134e5cbbf1db22088a.zip | |
[OPENMP] Capture references to global variables.
In C++11 variable to global variables are considered as constant
expressions and these variables are not captured in the outlined
regions. Patch allows capturing of such variables in the OpenMP regions.
llvm-svn: 315074
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 1bb57b6e2bb..b1b7c1b60b0 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2297,8 +2297,12 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { VD->isUsableInConstantExpressions(getContext()) && VD->checkInitIsICE() && // Do not emit if it is private OpenMP variable. - !(E->refersToEnclosingVariableOrCapture() && CapturedStmtInfo && - LocalDeclMap.count(VD))) { + !(E->refersToEnclosingVariableOrCapture() && + ((CapturedStmtInfo && + (LocalDeclMap.count(VD->getCanonicalDecl()) || + CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) || + LambdaCaptureFields.lookup(VD->getCanonicalDecl()) || + isa<BlockDecl>(CurCodeDecl)))) { llvm::Constant *Val = ConstantEmitter(*this).emitAbstract(E->getLocation(), *VD->evaluateValue(), |

