Switch the semantic DeclContext for a block-scope declaration of a function or
variable from being the function to being the enclosing namespace scope (in
C++) or the TU (in C). This allows us to fix a selection of related issues
where we would build incorrect redeclaration chains for such declarations, and
fail to notice type mismatches.

Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
which is only found when searching scopes, and not found when searching
DeclContexts. Such a declaration is only made visible in its DeclContext if
there are no non-LocalExtern declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191064 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index f03f499..775cf00 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -9,7 +9,7 @@
 // CHECK: @_ZGVZN1N1gEvE1a = internal global
 
 //CHECK: @pr5966_i = external global
-//CHECK: @_ZL8pr5966_i = internal global
+//CHECK: @_ZL8pr5966_j = internal global
 
 // CHECK-LABEL: define zeroext i1 @_ZplRK1YRA100_P1X
 bool operator+(const Y&, X* (&xs)[100]) { return false; }
@@ -314,10 +314,10 @@
   pr5966_i = 0;
 }
 
-static int pr5966_i;
+static int pr5966_j;
 
 void pr5966_bar() {
-  pr5966_i = 0;
+  pr5966_j = 0;
 }
 
 namespace test0 {
@@ -652,10 +652,10 @@
     foo();
   }
 
-  static char foo() {}
+  static char bar() {}
   void test1() {
-    // CHECK: call signext i8 @_ZN6test24L3fooEv()
-    foo();
+    // CHECK: call signext i8 @_ZN6test24L3barEv()
+    bar();
   }
 }