[OPENMP] Improved variable lookup procedure for threadprivate variables.

llvm-svn: 191416
diff --git a/clang/test/OpenMP/threadprivate_ast_print.cpp b/clang/test/OpenMP/threadprivate_ast_print.cpp
index ddf4882..823a4d6 100644
--- a/clang/test/OpenMP/threadprivate_ast_print.cpp
+++ b/clang/test/OpenMP/threadprivate_ast_print.cpp
@@ -15,7 +15,7 @@
  static int b;
 // CHECK: static int b;
 #pragma omp threadprivate(b)
-// CHECK-NEXT: #pragma omp threadprivate(b)
+// CHECK-NEXT: #pragma omp threadprivate(St1::b)
 } d;
 
 int a, b;
@@ -38,6 +38,15 @@
 //CHECK-NEXT: static T v;
 //CHECK-NEXT: #pragma omp threadprivate(v)
 
+namespace ns{
+  int a;
+}
+// CHECK: namespace ns {
+// CHECK-NEXT: int a;
+// CHECK-NEXT: }
+#pragma omp threadprivate(ns::a)
+// CHECK-NEXT: #pragma omp threadprivate(ns::a)
+
 int main () {
   static int a;
 // CHECK: static int a;
diff --git a/clang/test/OpenMP/threadprivate_messages.cpp b/clang/test/OpenMP/threadprivate_messages.cpp
index a188a0b..4858549 100644
--- a/clang/test/OpenMP/threadprivate_messages.cpp
+++ b/clang/test/OpenMP/threadprivate_messages.cpp
@@ -60,12 +60,12 @@
 #pragma omp threadprivate (g)
 
 namespace ns {
-  int m; // expected-note 2 {{'m' defined here}}
+  int m;
 #pragma omp threadprivate (m)
 }
 #pragma omp threadprivate (m) // expected-error {{use of undeclared identifier 'm'}}
-#pragma omp threadprivate (ns::m) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'ns::m' variable declaration}}
-#pragma omp threadprivate (ns:m) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'ns::m' variable declaration}}
+#pragma omp threadprivate (ns::m) // expected-error {{'#pragma omp threadprivate' must precede all references to variable 'ns::m'}}
+#pragma omp threadprivate (ns:m) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} expected-error {{'#pragma omp threadprivate' must precede all references to variable 'ns::m'}}
 
 const int h = 12;
 const volatile int i = 10;