[cfe-commits] r63460 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 30 16:59:11 PST 2009
Author: fjahanian
Date: Fri Jan 30 18:59:10 2009
New Revision: 63460
URL: http://llvm.org/viewvc/llvm-project?rev=63460&view=rev
Log:
Recognize class's visibility attribute and set its linkage
to private extern (in objc2 nonfragile abi).
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=63460&r1=63459&r2=63460&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jan 30 18:59:10 2009
@@ -573,7 +573,8 @@
llvm::GlobalVariable * BuildClassMetaData(std::string &ClassName,
llvm::Constant *IsAGV,
llvm::Constant *SuperClassGV,
- llvm::Constant *ClassRoGV);
+ llvm::Constant *ClassRoGV,
+ bool HiddenVisibility);
llvm::Constant *GetMethodConstant(const ObjCMethodDecl *MD);
@@ -3361,7 +3362,8 @@
std::string &ClassName,
llvm::Constant *IsAGV,
llvm::Constant *SuperClassGV,
- llvm::Constant *ClassRoGV) {
+ llvm::Constant *ClassRoGV,
+ bool HiddenVisibility) {
std::vector<llvm::Constant*> Values(5);
Values[0] = IsAGV;
Values[1] = SuperClassGV
@@ -3384,6 +3386,8 @@
&CGM.getModule());
GV->setSection("__DATA, __objc_const");
GV->setAlignment(GetPointerAlign());
+ if (HiddenVisibility)
+ GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
UsedGlobals.push_back(GV);
return GV;
}
@@ -3421,7 +3425,8 @@
llvm::GlobalVariable *SuperClassGV, *IsAGV;
- if (IsClassHidden(ID->getClassInterface()))
+ bool classIsHidden = IsClassHidden(ID->getClassInterface());
+ if (classIsHidden)
flags |= OBJC2_CLS_HIDDEN;
if (!ID->getClassInterface()->getSuperClass()) {
// class is root
@@ -3467,11 +3472,12 @@
InstanceSize,ID);
std::string TClassName = ObjCMetaClassName + ClassName;
llvm::GlobalVariable *MetaTClass =
- BuildClassMetaData(TClassName, IsAGV, SuperClassGV, CLASS_RO_GV);
+ BuildClassMetaData(TClassName, IsAGV, SuperClassGV, CLASS_RO_GV,
+ classIsHidden);
// Metadata for the class
flags = CLS;
- if (IsClassHidden(ID->getClassInterface()))
+ if (classIsHidden)
flags |= OBJC2_CLS_HIDDEN;
if (!ID->getClassInterface()->getSuperClass()) {
flags |= CLS_ROOT;
@@ -3532,7 +3538,8 @@
TClassName = ObjCClassName + ClassName;
llvm::GlobalVariable *ClassMD =
- BuildClassMetaData(TClassName, MetaTClass, SuperClassGV, CLASS_RO_GV);
+ BuildClassMetaData(TClassName, MetaTClass, SuperClassGV, CLASS_RO_GV,
+ classIsHidden);
DefinedClasses.push_back(ClassMD);
}
@@ -3745,6 +3752,11 @@
Ivar->getAccessControl() == ObjCIvarDecl::Protected);
if (!globalVisibility)
IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ else
+ if (const ObjCInterfaceDecl *OID = ID->getClassInterface())
+ if (IsClassHidden(OID))
+ IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+
IvarOffsetGV->setSection("__DATA, __objc_const");
UsedGlobals.push_back(IvarOffsetGV);
More information about the cfe-commits
mailing list