KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths.

This commit is contained in:
Joe Groff
2017-04-21 15:48:13 -07:00
parent 9222960df5
commit d5cdf658da
11 changed files with 311 additions and 20 deletions

View File

@@ -126,6 +126,16 @@ IRGenModule::getAddrOfKeyPathPattern(KeyPathPattern *pattern,
fields.add(emitMetadataGenerator(rootTy));
fields.add(emitMetadataGenerator(valueTy));
// Add a pointer to the ObjC KVC compatibility string, if there is one, or
// null otherwise.
llvm::Constant *objcString;
if (!pattern->getObjCString().empty()) {
objcString = getAddrOfGlobalString(pattern->getObjCString());
} else {
objcString = llvm::ConstantPointerNull::get(Int8PtrTy);
}
fields.add(objcString);
// Leave a placeholder for the buffer header, since we need to know the full
// buffer size to fill it in.
auto headerPlaceholder = fields.addPlaceholderWithSize(Int32Ty);