kkwli0 created this revision.
kkwli0 added reviewers: rsmith, hfinkel, fraggamuffin, sfantao, ABataev.
kkwli0 added a subscriber: cfe-commits.

This patch is to fix the problem of specifying static local variables on the 
data-sharing attribute clause.  Currently, clang flags it as errors.

int main() {
 static int x; 
  int i; 
#pragma omp parallel for reduction(+:x) 
  for (i=0; i<10; i++) { 
    x = 1; 
  } 
} 


http://reviews.llvm.org/D11619

Files:
  lib/Sema/SemaOpenMP.cpp

Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -521,7 +521,7 @@
     // in a Construct, C/C++, predetermined, p.7]
     //  Variables with static storage duration that are declared in a scope
     //  inside the construct are shared.
-    if (D->isStaticDataMember() || D->isStaticLocal()) {
+    if (D->isStaticDataMember()) {
       DSAVarData DVarTemp =
           hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
       if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)


Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -521,7 +521,7 @@
     // in a Construct, C/C++, predetermined, p.7]
     //  Variables with static storage duration that are declared in a scope
     //  inside the construct are shared.
-    if (D->isStaticDataMember() || D->isStaticLocal()) {
+    if (D->isStaticDataMember()) {
       DSAVarData DVarTemp =
           hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
       if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to