diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-07-14 10:32:29 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-07-14 10:32:29 +0000 |
commit | b44fdfc7b242ad9ecbbeee1c2ceb55ffadd64832 (patch) | |
tree | 486fa003ba5cbf3c4a4dc7c63201c92c25ddd7ae /clang/lib/Sema/SemaExpr.cpp | |
parent | d9c0bcfd2844035a20806fc3959ef51dc018b879 (diff) | |
download | bcm5719-llvm-b44fdfc7b242ad9ecbbeee1c2ceb55ffadd64832.tar.gz bcm5719-llvm-b44fdfc7b242ad9ecbbeee1c2ceb55ffadd64832.zip |
[OPENMP] Drop type qualifiers from private variables.
If the variable is marked as private in OpenMP construct, the reference to this variable should not keep type qualifiers for the original variable. Private copy is not volatile or constant, so we can use unqualified type for private copy.
llvm-svn: 242133
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a4911c20c68..1ae983cad22 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -12533,6 +12533,8 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI, // By default, capture variables by reference. bool ByRef = true; // Using an LValue reference type is consistent with Lambdas (see below). + if (S.getLangOpts().OpenMP && S.IsOpenMPCapturedVar(Var)) + DeclRefType = DeclRefType.getUnqualifiedType(); CaptureType = S.Context.getLValueReferenceType(DeclRefType); Expr *CopyExpr = nullptr; if (BuildAndDiagnose) { @@ -12766,6 +12768,7 @@ bool Sema::tryCaptureVariable( if (RSI->CapRegionKind == CR_OpenMP) { if (isOpenMPPrivateVar(Var, OpenMPLevel)) { Nested = true; + DeclRefType = DeclRefType.getUnqualifiedType(); CaptureType = Context.getLValueReferenceType(DeclRefType); break; } |