summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-07-13 02:58:44 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-07-13 02:58:44 +0000
commit4f515a6e80176b83bf572d4c46b0c887ca89089f (patch)
tree42bf14c9cf407e8fa8421b4ace487ce7c2500388 /clang/lib/CodeGen
parentff1c327ebb7ea3f1aa6a336a82154b6548750a56 (diff)
downloadbcm5719-llvm-4f515a6e80176b83bf572d4c46b0c887ca89089f.tar.gz
bcm5719-llvm-4f515a6e80176b83bf572d4c46b0c887ca89089f.zip
CodeGen: minor cleanup, NFC
Initialise more members in initializer lists. Invert the condition that had grown to be pretty confusing. The `_objc_empty_vtable` is only used on macOS <10.9. This simplifies the code. NFC. llvm-svn: 275241
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index a4dc628396b..09d1cebcefa 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5204,9 +5204,8 @@ void CGObjCMac::FinishModule() {
}
CGObjCNonFragileABIMac::CGObjCNonFragileABIMac(CodeGen::CodeGenModule &cgm)
- : CGObjCCommonMac(cgm),
- ObjCTypes(cgm) {
- ObjCEmptyCacheVar = ObjCEmptyVtableVar = nullptr;
+ : CGObjCCommonMac(cgm), ObjCTypes(cgm), ObjCEmptyCacheVar(nullptr),
+ ObjCEmptyVtableVar(nullptr) {
ObjCABI = 2;
}
@@ -5982,28 +5981,15 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) {
std::string ClassName = ID->getObjCRuntimeNameAsString();
if (!ObjCEmptyCacheVar) {
ObjCEmptyCacheVar = new llvm::GlobalVariable(
- CGM.getModule(),
- ObjCTypes.CacheTy,
- false,
- llvm::GlobalValue::ExternalLinkage,
- nullptr,
- "_objc_empty_cache");
-
- // Make this entry NULL for any iOS device target, any iOS simulator target,
- // OS X with deployment target 10.9 or later.
+ CGM.getModule(), ObjCTypes.CacheTy, false,
+ llvm::GlobalValue::ExternalLinkage, nullptr, "_objc_empty_cache");
+
+ // Only OS X with deployment version <10.9 use the empty vtable symbol
const llvm::Triple &Triple = CGM.getTarget().getTriple();
- if (Triple.isiOS() || Triple.isWatchOS() ||
- (Triple.isMacOSX() && !Triple.isMacOSXVersionLT(10, 9)))
- // This entry will be null.
- ObjCEmptyVtableVar = nullptr;
- else
+ if (Triple.isMacOSX() && Triple.isMacOSXVersionLT(10, 9))
ObjCEmptyVtableVar = new llvm::GlobalVariable(
- CGM.getModule(),
- ObjCTypes.ImpnfABITy,
- false,
- llvm::GlobalValue::ExternalLinkage,
- nullptr,
- "_objc_empty_vtable");
+ CGM.getModule(), ObjCTypes.ImpnfABITy, false,
+ llvm::GlobalValue::ExternalLinkage, nullptr, "_objc_empty_vtable");
}
assert(ID->getClassInterface() &&
"CGObjCNonFragileABIMac::GenerateClass - class is 0");
OpenPOWER on IntegriCloud