Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94352 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/const-global-linkage.cpp b/test/CodeGenCXX/const-global-linkage.cpp
index f88bc80..d0a055b 100644
--- a/test/CodeGenCXX/const-global-linkage.cpp
+++ b/test/CodeGenCXX/const-global-linkage.cpp
@@ -3,11 +3,11 @@
const int x = 10;
const int y = 20;
// CHECK-NOT: @x
-// CHECK: @y = internal constant i32 20
+// CHECK: @_ZL1y = internal constant i32 20
const int& b() { return y; }
const char z1[] = "asdf";
const char z2[] = "zxcv";
// CHECK-NOT: @z1
-// CHECK: @z2 = internal constant
+// CHECK: @_ZL2z2 = internal constant
const char* b2() { return z2; }
diff --git a/test/CodeGenCXX/deferred-global-init.cpp b/test/CodeGenCXX/deferred-global-init.cpp
index 5701479..802042d 100644
--- a/test/CodeGenCXX/deferred-global-init.cpp
+++ b/test/CodeGenCXX/deferred-global-init.cpp
@@ -5,7 +5,7 @@
static void* const a = foo;
void* bar() { return a; }
-// CHECK: @a = internal global i8* null
+// CHECK: @_ZL1a = internal global i8* null
// CHECK: define internal void @__cxx_global_var_init
// CHECK: load i8** @foo
diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp
index e799231..ef1dcf0 100644
--- a/test/CodeGenCXX/global-llvm-constant.cpp
+++ b/test/CodeGenCXX/global-llvm-constant.cpp
@@ -7,4 +7,4 @@
const A x;
-// CHECK: @x = internal global
+// CHECK: @_ZL1x = internal global
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 5947587..b4f2a3d 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -fblocks | FileCheck %s
-
struct X { };
struct Y { };
@@ -9,6 +8,9 @@
// CHECK: @_ZZN1N1gEvE1a = internal global
// CHECK: @_ZGVZN1N1gEvE1a = internal global
+//CHECK: @pr5966_i = external global
+//CHECK: @_ZL8pr5966_i = internal global
+
// CHECK: define zeroext i1 @_ZplRK1YRA100_P1X
bool operator+(const Y&, X* (&xs)[100]) { return false; }
@@ -310,7 +312,13 @@
// CHECK: define void @_Z1fU13block_pointerFiiiE
void f(int (^)(int, int)) { }
-// PR5869
-// CHECK: define internal void @_ZL2f2v
-static void f2() {}
-void f3() { f2(); }
+void pr5966_foo() {
+ extern int pr5966_i;
+ pr5966_i = 0;
+}
+
+static int pr5966_i;
+
+void pr5966_bar() {
+ pr5966_i = 0;
+}