diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-02-09 09:41:09 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-02-09 09:41:09 +0000 |
commit | 376b4a46907fcb35d6967575fdb89f5b3cb991b1 (patch) | |
tree | cabae042b7fb3fb13e321e1bbe1a3a827334657c /clang/lib/Sema/SemaOpenMP.cpp | |
parent | a4fd3beaa2946d62a3b5c59dc5b4b2323e5c92ac (diff) | |
download | bcm5719-llvm-376b4a46907fcb35d6967575fdb89f5b3cb991b1.tar.gz bcm5719-llvm-376b4a46907fcb35d6967575fdb89f5b3cb991b1.zip |
[OPENMP] Allow to reference threadprivate variable in same directive.
llvm-svn: 260213
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index d4c1f98c998..3ba5daa0304 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1179,8 +1179,10 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope, } QualType ExprType = VD->getType().getNonReferenceType(); - ExprResult DE = buildDeclRefExpr(*this, VD, ExprType, Id.getLoc()); - return DE; + return DeclRefExpr::Create(Context, NestedNameSpecifierLoc(), + SourceLocation(), VD, + /*RefersToEnclosingVariableOrCapture=*/false, + Id.getLoc(), ExprType, VK_LValue); } Sema::DeclGroupPtrTy @@ -1230,6 +1232,10 @@ Sema::CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef<Expr *> VarList) { VarDecl *VD = cast<VarDecl>(DE->getDecl()); SourceLocation ILoc = DE->getExprLoc(); + // Mark variable as used. + VD->setReferenced(); + VD->markUsed(Context); + QualType QType = VD->getType(); if (QType->isDependentType() || QType->isInstantiationDependentType()) { // It will be analyzed later. |