From: Alexey Bataev Date: Tue, 18 Mar 2014 12:19:12 +0000 (+0000) Subject: [OPENMP] DSA fix X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=567ad56d9f6860293112974319a079c560c31f68;p=clang [OPENMP] DSA fix git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204143 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 9fb7522ce5..1e1dbfed0b 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -134,7 +134,22 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter, VarDecl *D) { DSAVarData DVar; if (Iter == Stack.rend() - 1) { - DVar.CKind = OMPC_shared; + // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced + // in a region but not in construct] + // File-scope or namespace-scope variables referenced in called routines + // in the region are shared unless they appear in a threadprivate + // directive. + // TODO + if (!D->isFunctionOrMethodVarDecl()) + DVar.CKind = OMPC_shared; + + // OpenMP [2.9.1.2, Data-sharing Attribute Rules for Variables Referenced + // in a region but not in construct] + // Variables with static storage duration that are declared in called + // routines in the region are shared. + if (D->hasGlobalStorage()) + DVar.CKind = OMPC_shared; + return DVar; }