[cfe-commits] r118034 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGen/visibility.c
John McCall
rjmccall at apple.com
Tue Nov 2 11:38:14 PDT 2010
Author: rjmccall
Date: Tue Nov 2 13:38:13 2010
New Revision: 118034
URL: http://llvm.org/viewvc/llvm-project?rev=118034&view=rev
Log:
Unbreak private_extern, which apparently we had zero tests for.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGen/visibility.c
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=118034&r1=118033&r2=118034&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Nov 2 13:38:13 2010
@@ -278,11 +278,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
@@ -307,6 +308,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/trunk/test/CodeGen/visibility.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/visibility.c?rev=118034&r1=118033&r2=118034&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/visibility.c (original)
+++ cfe/trunk/test/CodeGen/visibility.c Tue Nov 2 13:38:13 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 cfe-commits
mailing list