[PCH] The diagnostic state points can refer to previously created
diagnostic states; make sure the ASTReader sets the diagnostic state
properly instead of always recreating it.

Fixes rdar://12581618 & http://llvm.org/PR14181

llvm-svn: 166987
diff --git a/clang/test/PCH/pragma-diag-section.cpp b/clang/test/PCH/pragma-diag-section.cpp
index 103b252..627156f 100644
--- a/clang/test/PCH/pragma-diag-section.cpp
+++ b/clang/test/PCH/pragma-diag-section.cpp
@@ -5,15 +5,13 @@
 // RUN: %clang_cc1 %s -emit-pch -o %t
 // RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
 
-// expected-no-diagnostics
-
 #ifndef HEADER
 #define HEADER
 
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wtautological-compare"
 template <typename T>
-struct TS {
+struct TS1 {
     void m() {
       T a = 0;
       T b = a==a;
@@ -23,9 +21,22 @@
 
 #else
 
+
+template <typename T>
+struct TS2 {
+    void m() {
+      T a = 0;
+      T b = a==a; // expected-warning {{self-comparison always evaluates to true}} expected-note@39 {{in instantiation of member function}}
+    }
+};
+
 void f() {
-    TS<int> ts;
-    ts.m();
+    TS1<int> ts1;
+    ts1.m();
+
+
+    TS2<int> ts2;
+    ts2.m();
 }
 
 #endif