Unbreak private_extern, which apparently we had zero tests for.

llvm-svn: 118034
This commit is contained in:
John McCall 2010-11-02 18:38:13 +00:00
parent 3bcbf84235
commit 23032653d7
2 changed files with 20 additions and 2 deletions

View File

@ -278,11 +278,12 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
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 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
// 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

View File

@ -19,6 +19,10 @@ int g_def = 0;
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 @@ void __attribute__((visibility("default"))) test1(struct Test1 *v) { }
// 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;