[llvm-branch-commits] [cfe-branch] r118046 - in /cfe/branches/Apple/whitney: lib/AST/Decl.cpp test/CodeGen/visibility.c
Daniel Dunbar
daniel at zuster.org
Tue Nov 2 13:32:32 PDT 2010
Author: ddunbar
Date: Tue Nov 2 15:32:32 2010
New Revision: 118046
URL: http://llvm.org/viewvc/llvm-project?rev=118046&view=rev
Log:
Merge r118034:
--
Author: John McCall <rjmccall at apple.com>
Date: Tue Nov 2 18:38:13 2010 +0000
Unbreak private_extern, which apparently we had zero tests for.
Modified:
cfe/branches/Apple/whitney/lib/AST/Decl.cpp
cfe/branches/Apple/whitney/test/CodeGen/visibility.c
Modified: cfe/branches/Apple/whitney/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/Decl.cpp?rev=118046&r1=118045&r2=118046&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/Decl.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/Decl.cpp Tue Nov 2 15:32:32 2010
@@ -262,11 +262,12 @@
LV.mergeVisibility(TypeLV.second);
}
+ if (Var->getStorageClass() == SC_PrivateExtern)
+ LV.setVisibility(HiddenVisibility, true);
+
if (!Context.getLangOptions().CPlusPlus &&
(Var->getStorageClass() == SC_Extern ||
Var->getStorageClass() == SC_PrivateExtern)) {
- if (Var->getStorageClass() == SC_PrivateExtern)
- LV.setVisibility(HiddenVisibility, true);
// C99 6.2.2p4:
// For an identifier declared with the storage-class specifier
@@ -291,6 +292,9 @@
// for justification). In practice, GCC doesn't do this, so it's
// just too painful to make work.
+ if (Function->getStorageClass() == SC_PrivateExtern)
+ LV.setVisibility(HiddenVisibility, true);
+
// C99 6.2.2p5:
// If the declaration of an identifier for a function has no
// storage-class specifier, its linkage is determined exactly
Modified: cfe/branches/Apple/whitney/test/CodeGen/visibility.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGen/visibility.c?rev=118046&r1=118045&r2=118046&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGen/visibility.c (original)
+++ cfe/branches/Apple/whitney/test/CodeGen/visibility.c Tue Nov 2 15:32:32 2010
@@ -19,6 +19,10 @@
extern int g_ext;
static char g_deferred[] = "hello";
+// CHECK-DEFAULT: @test4 = hidden global i32 10
+// CHECK-PROTECTED: @test4 = hidden global i32 10
+// CHECK-HIDDEN: @test4 = hidden global i32 10
+
// CHECK-DEFAULT: define i32 @f_def()
// CHECK-DEFAULT: declare void @f_ext()
// CHECK-DEFAULT: define internal void @f_deferred()
@@ -53,3 +57,13 @@
// CHECK-HIDDEN: define void @test2()
void test2(void);
void __attribute__((visibility("default"))) test2(void) {}
+
+// CHECK-DEFAULT: define hidden void @test3()
+// CHECK-PROTECTED: define hidden void @test3()
+// CHECK-HIDDEN: define hidden void @test3()
+extern void test3(void);
+__private_extern__ void test3(void) {}
+
+// Top of file.
+extern int test4;
+__private_extern__ int test4 = 10;
More information about the llvm-branch-commits
mailing list