If a template instantation introduces a name into a namespace, we need to write
out a visible update record for that namespace even if it was never declared in
this module.

llvm-svn: 204554
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h
index 0b1614d..6ecc2ca 100644
--- a/clang/test/Modules/Inputs/cxx-templates-a.h
+++ b/clang/test/Modules/Inputs/cxx-templates-a.h
@@ -48,3 +48,5 @@
 template<> struct MergeSpecializations<char> {
   typedef int explicitly_specialized_in_a;
 };
+
+void InstantiateWithFriend(Std::WithFriend<int> wfi) {}
diff --git a/clang/test/Modules/Inputs/cxx-templates-common.h b/clang/test/Modules/Inputs/cxx-templates-common.h
index 40a11e2..77e3ddd 100644
--- a/clang/test/Modules/Inputs/cxx-templates-common.h
+++ b/clang/test/Modules/Inputs/cxx-templates-common.h
@@ -9,3 +9,9 @@
 template<typename T> struct CommonTemplate {
   enum E { a = 1, b = 2, c = 3 };
 };
+
+namespace Std {
+  template<typename T> struct WithFriend {
+    friend bool operator!=(const WithFriend &A, const WithFriend &B) { return false; }
+  };
+}
diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp
index a154388..d933193 100644
--- a/clang/test/Modules/cxx-templates.cpp
+++ b/clang/test/Modules/cxx-templates.cpp
@@ -117,6 +117,10 @@
   c = d;
 }
 
+bool testFriendInClassTemplate(Std::WithFriend<int> wfi) {
+  return wfi != wfi;
+}
+
 // CHECK-GLOBAL:      DeclarationName 'f'
 // CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f'
 // CHECK-GLOBAL-NEXT: `-FunctionTemplate {{.*}} 'f'