[OPENMP] Do not allow variables to be first|last-privates in
distribute directives.

OpenMP standard does not allow to mark the variables as firstprivate and lastprivate at the same time in distribute-based directives. Patch fixes this problem.

llvm-svn: 319560
diff --git a/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp b/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp
index 54a3649..351e158 100644
--- a/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp
@@ -82,7 +82,7 @@
 // CHECK-NEXT: a = 2;
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
+#pragma omp distribute parallel for private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
   for (int i = 0; i < 2; ++i)
     for (int j = 0; j < 2; ++j)
       for (int j = 0; j < 2; ++j)
@@ -93,8 +93,8 @@
       for (int j = 0; j < 2; ++j)
         for (int j = 0; j < 2; ++j)
           for (int j = 0; j < 2; ++j)
-	    a++;
-  // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
+            a++;
+  // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
   // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
diff --git a/clang/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
index 3e288c3..67075ca 100644
--- a/clang/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
@@ -42,7 +42,7 @@
 };
 class S5 {
   int a;
-  S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
+  S5(const S5 &s5) : a(s5.a) {} // expected-note 2 {{implicitly declared private here}}
 
 public:
   S5() : a(0) {}
@@ -50,7 +50,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -150,9 +150,10 @@
 #pragma omp distribute parallel for firstprivate(i)
   for (int k = 0; k < argc; ++k)
     ++k;
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute parallel for lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel private(i)
@@ -314,14 +315,16 @@
 #pragma omp distribute parallel for firstprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute parallel for lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute parallel for lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel
diff --git a/clang/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
index ebc7a66..b38d978 100644
--- a/clang/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -313,14 +313,16 @@
 #pragma omp distribute parallel for lastprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{firstprivate variable cannot be lastprivate}} expected-note@+3 {{defined as firstprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp distribute parallel for firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute parallel for lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
   static int si;
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
index 464acbe..2101063 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
@@ -83,7 +83,7 @@
 // CHECK-NEXT: a = 2;
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
+#pragma omp distribute parallel for simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
   for (int i = 0; i < 2; ++i)
     for (int j = 0; j < 2; ++j)
       for (int j = 0; j < 2; ++j)
@@ -94,8 +94,8 @@
       for (int j = 0; j < 2; ++j)
         for (int j = 0; j < 2; ++j)
           for (int j = 0; j < 2; ++j)
-	    a++;
-  // CHECK: #pragma omp distribute parallel for simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
+            a++;
+  // CHECK: #pragma omp distribute parallel for simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
   // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp
index 07d30e4..6464076 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp
@@ -42,7 +42,7 @@
 };
 class S5 {
   int a;
-  S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
+  S5(const S5 &s5) : a(s5.a) {} // expected-note 2 {{implicitly declared private here}}
 
 public:
   S5() : a(0) {}
@@ -50,7 +50,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -150,9 +150,10 @@
 #pragma omp distribute parallel for simd firstprivate(i)
   for (int k = 0; k < argc; ++k)
     ++k;
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute parallel for simd lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel private(i)
@@ -314,14 +315,16 @@
 #pragma omp distribute parallel for simd firstprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute parallel for simd lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute parallel for simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp
index e54089d..73450d4 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -313,14 +313,16 @@
 #pragma omp distribute parallel for simd lastprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{firstprivate variable cannot be lastprivate}} expected-note@+3 {{defined as firstprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp distribute parallel for simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute parallel for simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
   static int si;
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp
index 1fedb3c..d137d47 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -790,9 +790,10 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute parallel for simd lastprivate(s) firstprivate(s)
+#pragma omp distribute parallel for simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c b/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
index bb24c23..4d07162 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
@@ -851,16 +851,19 @@
     ;
 
   int x, y, z;
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
 #pragma omp distribute parallel for simd lastprivate(x) firstprivate(x)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+3 2 {{lastprivate variable cannot be firstprivate}} expected-note@+3 2 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
 #pragma omp distribute parallel for simd lastprivate(x, y) firstprivate(x, y)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+3 3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
 #pragma omp distribute parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
diff --git a/clang/test/OpenMP/distribute_simd_ast_print.cpp b/clang/test/OpenMP/distribute_simd_ast_print.cpp
index 6ac4b84..3246ccb 100644
--- a/clang/test/OpenMP/distribute_simd_ast_print.cpp
+++ b/clang/test/OpenMP/distribute_simd_ast_print.cpp
@@ -84,14 +84,14 @@
 
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) reduction(+ : h) dist_schedule(static,N)
+#pragma omp distribute simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) reduction(+ : h) dist_schedule(static,N)
   for (int i = 0; i < 2; ++i)
     for (int j = 0; j < 2; ++j)
       for (int k = 0; k < 10; ++k)
         for (int m = 0; m < 10; ++m)
           for (int n = 0; n < 10; ++n)
             a++;
-// CHECK: #pragma omp distribute simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) reduction(+: h) dist_schedule(static, N)
+// CHECK: #pragma omp distribute simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) reduction(+: h) dist_schedule(static, N)
 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
diff --git a/clang/test/OpenMP/distribute_simd_firstprivate_messages.cpp b/clang/test/OpenMP/distribute_simd_firstprivate_messages.cpp
index b9267a3..f0c293b 100644
--- a/clang/test/OpenMP/distribute_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_simd_firstprivate_messages.cpp
@@ -42,7 +42,7 @@
 };
 class S5 {
   int a;
-  S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
+  S5(const S5 &s5) : a(s5.a) {} // expected-note 2 {{implicitly declared private here}}
 
 public:
   S5() : a(0) {}
@@ -50,7 +50,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -150,9 +150,10 @@
 #pragma omp distribute simd firstprivate(i)
   for (int k = 0; k < argc; ++k)
     ++k;
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute simd lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel private(i)
@@ -314,14 +315,16 @@
 #pragma omp distribute simd firstprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
+#pragma omp distribute simd lastprivate(g) firstprivate(g)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel
diff --git a/clang/test/OpenMP/distribute_simd_lastprivate_messages.cpp b/clang/test/OpenMP/distribute_simd_lastprivate_messages.cpp
index a891435..82ce15e 100644
--- a/clang/test/OpenMP/distribute_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/distribute_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -313,14 +313,16 @@
 #pragma omp distribute simd lastprivate(j)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{firstprivate variable cannot be lastprivate}} expected-note@+3 {{defined as firstprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp distribute simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i)
     foo();
+// expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams
-#pragma omp distribute simd lastprivate(n) firstprivate(n) // OK
+#pragma omp distribute simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i)
     foo();
   static int si;
diff --git a/clang/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
index 602e039..934149e 100644
--- a/clang/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
@@ -125,7 +125,8 @@
 #pragma omp target teams distribute firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute lastprivate(argc), firstprivate(argc) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp
index 5cfe782..8982918 100644
--- a/clang/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -215,10 +215,12 @@
 #pragma omp target teams distribute lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+// expected-error@+1 {{firstprivate variable cannot be lastprivate}} expected-note@+1 {{defined as firstprivate}}
+#pragma omp target teams distribute firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute lastprivate(n) firstprivate(n) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp
index 441abcb..0a825ab 100644
--- a/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -607,7 +607,8 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
-#pragma omp target teams distribute lastprivate(s) firstprivate(s)
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/target_teams_distribute_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_misc_messages.c
index bf4df08..33496a7 100644
--- a/clang/test/OpenMP/target_teams_distribute_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_misc_messages.c
@@ -285,12 +285,15 @@
     ;
 
   int x, y, z;
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
 #pragma omp target teams distribute lastprivate(x) firstprivate(x)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 2 {{lastprivate variable cannot be firstprivate}} expected-note@+1 2 {{defined as lastprivate}}
 #pragma omp target teams distribute lastprivate(x, y) firstprivate(x, y)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 3 {{lastprivate variable cannot be firstprivate}} expected-note@+1 3 {{defined as lastprivate}}
 #pragma omp target teams distribute lastprivate(x, y, z) firstprivate(x, y, z)
   for (i = 0; i < 16; ++i)
     ;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp
index d4e7083..0d83550 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp
@@ -124,7 +124,8 @@
 #pragma omp target teams distribute parallel for firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for lastprivate(argc), firstprivate(argc) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp
index ccecb63..84a6df2 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -216,10 +216,12 @@
 #pragma omp target teams distribute parallel for lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+// expected-error@+1 {{firstprivate variable cannot be lastprivate}} expected-note@+1 {{defined as firstprivate}}
+#pragma omp target teams distribute parallel for firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for lastprivate(n) firstprivate(n) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp
index d912737..57ab273 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -605,7 +605,8 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
-#pragma omp target teams distribute parallel for lastprivate(s) firstprivate(s)
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_parallel_for_misc_messages.c
index 769be6c..c48a2df 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_misc_messages.c
@@ -285,12 +285,15 @@
     ;
 
   int x, y, z;
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for lastprivate(x) firstprivate(x)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 2 {{lastprivate variable cannot be firstprivate}} expected-note@+1 2 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for lastprivate(x, y) firstprivate(x, y)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 3 {{lastprivate variable cannot be firstprivate}} expected-note@+1 3 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for lastprivate(x, y, z) firstprivate(x, y, z)
   for (i = 0; i < 16; ++i)
     ;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp
index d26044a..4790b4b 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp
@@ -124,7 +124,8 @@
 #pragma omp target teams distribute parallel for simd firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for simd lastprivate(argc), firstprivate(argc) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for simd lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp
index 7f17d67..156f1a6 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -216,10 +216,12 @@
 #pragma omp target teams distribute parallel for simd lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+// expected-error@+1 {{firstprivate variable cannot be lastprivate}} expected-note@+1 {{defined as firstprivate}}
+#pragma omp target teams distribute parallel for simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for simd lastprivate(n) firstprivate(n) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp
index 0ed57ba..a16dec1 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -608,7 +608,8 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
-#pragma omp target teams distribute parallel for simd lastprivate(s) firstprivate(s)
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute parallel for simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
index 5c02ee3..1ea02f6 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
@@ -285,12 +285,15 @@
     ;
 
   int x, y, z;
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for simd lastprivate(x) firstprivate(x)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 2 {{lastprivate variable cannot be firstprivate}} expected-note@+1 2 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for simd lastprivate(x, y) firstprivate(x, y)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 3 {{lastprivate variable cannot be firstprivate}} expected-note@+1 3 {{defined as lastprivate}}
 #pragma omp target teams distribute parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
   for (i = 0; i < 16; ++i)
     ;
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp
index b9b039e..235533b 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp
@@ -124,7 +124,8 @@
 #pragma omp target teams distribute simd firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute simd lastprivate(argc), firstprivate(argc) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute simd lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
 #pragma omp target teams distribute simd firstprivate(argc) map(argc) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target teams distribute simd' directive}} expected-note {{defined as firstprivate}}
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp
index b8b1916..a143dc2 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -216,10 +216,12 @@
 #pragma omp target teams distribute simd lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+// expected-error@+1 {{firstprivate variable cannot be lastprivate}} expected-note@+1 {{defined as firstprivate}}
+#pragma omp target teams distribute simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute simd lastprivate(n) firstprivate(n) // OK
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp
index aae00a4..09aa548 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -607,7 +607,8 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
-#pragma omp target teams distribute simd lastprivate(s) firstprivate(s)
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
+#pragma omp target teams distribute simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
index 4a7adb6..70ec508 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
@@ -285,12 +285,15 @@
     ;
 
   int x, y, z;
+// expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
 #pragma omp target teams distribute simd lastprivate(x) firstprivate(x)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 2 {{lastprivate variable cannot be firstprivate}} expected-note@+1 2 {{defined as lastprivate}}
 #pragma omp target teams distribute simd lastprivate(x, y) firstprivate(x, y)
   for (i = 0; i < 16; ++i)
     ;
+// expected-error@+1 3 {{lastprivate variable cannot be firstprivate}} expected-note@+1 3 {{defined as lastprivate}}
 #pragma omp target teams distribute simd lastprivate(x, y, z) firstprivate(x, y, z)
   for (i = 0; i < 16; ++i)
     ;
diff --git a/clang/test/OpenMP/teams_distribute_firstprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_firstprivate_messages.cpp
index a710807..1a2b5f3 100644
--- a/clang/test/OpenMP/teams_distribute_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_firstprivate_messages.cpp
@@ -144,8 +144,9 @@
 #pragma omp teams distribute firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute lastprivate(argc), firstprivate(argc) // OK
+#pragma omp teams distribute lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/teams_distribute_lastprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_lastprivate_messages.cpp
index 6941197..392607e 100644
--- a/clang/test/OpenMP/teams_distribute_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -255,12 +255,14 @@
 #pragma omp teams distribute lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{firstprivate variable cannot be lastprivate}} expected-note@+2 {{defined as firstprivate}}
 #pragma omp target
-#pragma omp teams distribute firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp teams distribute firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute lastprivate(n) firstprivate(n) // OK
+#pragma omp teams distribute lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/teams_distribute_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_loop_messages.cpp
index fcec84e..acab1f76 100644
--- a/clang/test/OpenMP/teams_distribute_loop_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -696,8 +696,9 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute lastprivate(s) firstprivate(s)
+#pragma omp teams distribute lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp
index e6314c2..90e78de 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp
@@ -144,8 +144,9 @@
 #pragma omp teams distribute parallel for firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for lastprivate(argc), firstprivate(argc) // OK
+#pragma omp teams distribute parallel for lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp
index c5f457a..b58bac4 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -255,12 +255,14 @@
 #pragma omp teams distribute parallel for lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{firstprivate variable cannot be lastprivate}} expected-note@+2 {{defined as firstprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp teams distribute parallel for firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for lastprivate(n) firstprivate(n) // OK
+#pragma omp teams distribute parallel for lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp
index e0c315f..a2f6f67 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -691,8 +691,9 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for lastprivate(s) firstprivate(s)
+#pragma omp teams distribute parallel for lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp
index cbbb313..668337d 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp
@@ -144,8 +144,9 @@
 #pragma omp teams distribute parallel for simd firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for simd lastprivate(argc), firstprivate(argc) // OK
+#pragma omp teams distribute parallel for simd lastprivate(argc), firstprivate(argc)
   for (i = 0; i < argc; ++i) foo();
 
   return 0;
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp
index 62f8559..204be4c 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -255,12 +255,14 @@
 #pragma omp teams distribute parallel for simd lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{firstprivate variable cannot be lastprivate}} expected-note@+2 {{defined as firstprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp teams distribute parallel for simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for simd lastprivate(n) firstprivate(n) // OK
+#pragma omp teams distribute parallel for simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp
index 0332562..66361b6 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -693,8 +693,9 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute parallel for simd lastprivate(s) firstprivate(s)
+#pragma omp teams distribute parallel for simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }
diff --git a/clang/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp
index 324672c..bcc0e35 100644
--- a/clang/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp
@@ -144,6 +144,7 @@
 #pragma omp teams distribute simd firstprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
 #pragma omp teams distribute simd lastprivate(argc), firstprivate(argc) // OK
   for (i = 0; i < argc; ++i) foo();
diff --git a/clang/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp b/clang/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp
index 8bdb380..51dbfef 100644
--- a/clang/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp
@@ -25,7 +25,7 @@
 const S2 ba[5];
 class S3 {
   int a;
-  S3 &operator=(const S3 &s3); // expected-note 2 {{implicitly declared private here}}
+  S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
 
 public:
   S3() : a(0) {}
@@ -52,7 +52,7 @@
 };
 class S6 {
   int a;
-  S6() : a(0) {}
+  S6() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S6(const S6 &s6) : a(s6.a) {}
@@ -255,12 +255,14 @@
 #pragma omp teams distribute simd lastprivate(j)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{firstprivate variable cannot be lastprivate}} expected-note@+2 {{defined as firstprivate}}
 #pragma omp target
-#pragma omp teams distribute simd firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
+#pragma omp teams distribute simd firstprivate(m) lastprivate(m)
   for (i = 0; i < argc; ++i) foo();
 
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute simd lastprivate(n) firstprivate(n) // OK
+#pragma omp teams distribute simd lastprivate(n) firstprivate(n) // expected-error {{calling a private constructor of class 'S6'}}
   for (i = 0; i < argc; ++i) foo();
 
   static int si;
diff --git a/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp
index 81fbfe8..60e07a3 100644
--- a/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp
@@ -2,7 +2,7 @@
 
 class S {
   int a;
-  S() : a(0) {}
+  S() : a(0) {} // expected-note {{implicitly declared private here}}
 
 public:
   S(int v) : a(v) {}
@@ -693,8 +693,9 @@
 
 void test_loop_firstprivate_lastprivate() {
   S s(4);
+// expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
 #pragma omp target
-#pragma omp teams distribute simd lastprivate(s) firstprivate(s)
+#pragma omp teams distribute simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
   for (int i = 0; i < 16; ++i)
     ;
 }