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 | 4c2015e24d03913fedb0ac31ee6426dbfafb5e38 (patch) | |
tree | da0fe2222c29c121385ad7301be6499acacb93ca /lib/Sema | |
parent | 1e4977ee8eb0efdf0ae17c7161bc43ea888c5be8 (diff) | |
download | clang-4c2015e24d03913fedb0ac31ee6426dbfafb5e38.tar.gz |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index dbefcdb66e..4e27170ae9 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -14893,7 +14893,8 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc, IsVariableAConstantExpression(Var, SemaRef.Context)) { // A reference initialized by a constant expression can never be // odr-used, so simply ignore it. - if (!Var->getType()->isReferenceType()) + if (!Var->getType()->isReferenceType() || + (SemaRef.LangOpts.OpenMP && SemaRef.IsOpenMPCapturedDecl(Var))) SemaRef.MaybeODRUseExprs.insert(E); } else if (OdrUseContext) { MarkVarDeclODRUsed(Var, Loc, SemaRef, |