[cfe-commits] r68543 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/class-obj-hidden-visibility.m test/CodeGenObjC/metadata_symbols.m
Fariborz Jahanian
fjahanian at apple.com
Tue Apr 7 13:26:30 PDT 2009
Author: fjahanian
Date: Tue Apr 7 15:26:30 2009
New Revision: 68543
URL: http://llvm.org/viewvc/llvm-project?rev=68543&view=rev
Log:
Propagte -fvisibility to objc2's class symbols.
Added:
cfe/trunk/test/CodeGenObjC/class-obj-hidden-visibility.m
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/metadata_symbols.m
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=68543&r1=68542&r2=68543&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Apr 7 15:26:30 2009
@@ -440,6 +440,8 @@
llvm::Constant *BuildIvarLayout(const ObjCImplementationDecl *OI,
bool ForStrongLayout);
+ bool IsClassHidden(const ObjCInterfaceDecl *ID);
+
void BuildAggrIvarLayout(const ObjCInterfaceDecl *OI,
const llvm::StructLayout *Layout,
const RecordDecl *RD,
@@ -1426,10 +1428,8 @@
eClassFlags_ABI2_HasCXXStructors = 0x00004 // <rdr://4923634>
};
-// <rdr://5142207&4705298&4843145>
-static bool IsClassHidden(const ObjCInterfaceDecl *ID) {
+bool CGObjCCommonMac::IsClassHidden(const ObjCInterfaceDecl *ID) {
if (const VisibilityAttr *attr = ID->getAttr<VisibilityAttr>()) {
- // FIXME: Support -fvisibility
switch (attr->getVisibility()) {
default:
assert(0 && "Unknown visibility");
@@ -1440,9 +1440,9 @@
case VisibilityAttr::HiddenVisibility:
return true;
}
- } else {
- return false; // FIXME: Support -fvisibility
- }
+ } else
+ return (CGM.getLangOptions().getVisibilityMode() ==
+ LangOptions::HiddenVisibility);
}
/*
@@ -4523,9 +4523,6 @@
else if (IsClassHidden(ID))
IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
else if (CGM.getLangOptions().getVisibilityMode() ==
- LangOptions::HiddenVisibility)
- IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
- else if (CGM.getLangOptions().getVisibilityMode() ==
LangOptions::DefaultVisibility)
IvarOffsetGV->setVisibility(llvm::GlobalValue::DefaultVisibility);
IvarOffsetGV->setSection("__DATA, __objc_const");
Added: cfe/trunk/test/CodeGenObjC/class-obj-hidden-visibility.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/class-obj-hidden-visibility.m?rev=68543&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/class-obj-hidden-visibility.m (added)
+++ cfe/trunk/test/CodeGenObjC/class-obj-hidden-visibility.m Tue Apr 7 15:26:30 2009
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fvisibility=hidden -triple x86_64-apple-darwin10 -S -o - %s | grep -e "private_extern _OBJC_" | count 2
+
+ at interface INTF @end
+
+ at implementation INTF @end
+
Modified: cfe/trunk/test/CodeGenObjC/metadata_symbols.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/metadata_symbols.m?rev=68543&r1=68542&r2=68543&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/metadata_symbols.m (original)
+++ cfe/trunk/test/CodeGenObjC/metadata_symbols.m Tue Apr 7 15:26:30 2009
@@ -10,10 +10,8 @@
// RUN: clang-cc -fvisibility=hidden -triple x86_64-apple-darwin9 -emit-llvm -o %t %s &&
-// FIXME: This is wrong, should be hidden
-// RUN: grep '@"OBJC_METACLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t &&
-// FIXME: This is wrong, should be hidden
-// RUN: grep '@"OBJC_CLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t &&
+// RUN: grep '@"OBJC_METACLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t &&
+// RUN: grep '@"OBJC_CLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t &&
// RUN: grep '@"OBJC_EHTYPE_$_EH1" = weak hidden global .*section "__DATA,__datacoal_nt,coalesced"' %t &&
// RUN: grep -F 'define internal void @"\01-[A im0]"' %t &&
// FIXME: Should include category name.
More information about the cfe-commits
mailing list