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,
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");
case VisibilityAttr::HiddenVisibility:
return true;
}
- } else {
- return false; // FIXME: Support -fvisibility
- }
+ } else
+ return (CGM.getLangOptions().getVisibilityMode() ==
+ LangOptions::HiddenVisibility);
}
/*
IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
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);
// 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.