[modules] When determining whether a name from a module replaces a name we
already have, check whether the name from the module is actually newer than the
existing declaration. If it isn't, we might (say) replace a visible declaration
with an injected friend, and thus make it invisible (or lose a default argument
or an array bound).
llvm-svn: 228661
diff --git a/clang/test/Modules/Inputs/cxx-lookup/module.modulemap b/clang/test/Modules/Inputs/cxx-lookup/module.modulemap
index 6d397af..385c8c9 100644
--- a/clang/test/Modules/Inputs/cxx-lookup/module.modulemap
+++ b/clang/test/Modules/Inputs/cxx-lookup/module.modulemap
@@ -6,3 +6,5 @@
}
module X { header "x.h" export * }
module Y { header "y.h" export * }
+module na { header "na.h" export * }
+module nb { header "nb.h" export * }
diff --git a/clang/test/Modules/Inputs/cxx-lookup/na.h b/clang/test/Modules/Inputs/cxx-lookup/na.h
new file mode 100644
index 0000000..684d37e
--- /dev/null
+++ b/clang/test/Modules/Inputs/cxx-lookup/na.h
@@ -0,0 +1 @@
+namespace N { struct S { friend struct foo; }; }
diff --git a/clang/test/Modules/Inputs/cxx-lookup/nb.h b/clang/test/Modules/Inputs/cxx-lookup/nb.h
new file mode 100644
index 0000000..092c882
--- /dev/null
+++ b/clang/test/Modules/Inputs/cxx-lookup/nb.h
@@ -0,0 +1 @@
+namespace N { extern int n; }
diff --git a/clang/test/Modules/cxx-lookup.cpp b/clang/test/Modules/cxx-lookup.cpp
index 47c879d..bd019c7 100644
--- a/clang/test/Modules/cxx-lookup.cpp
+++ b/clang/test/Modules/cxx-lookup.cpp
@@ -4,3 +4,8 @@
namespace llvm {}
#include "c2.h"
llvm::GlobalValue *p;
+
+#include "na.h"
+namespace N { struct foo; }
+#include "nb.h"
+N::foo *use_n_foo;