[PATCH] D69991: Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))
Pierre Habouzit via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 17 20:49:40 PST 2019
MadCoder updated this revision to Diff 229743.
MadCoder added a comment.
Diff against previous is:
diff
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 814f67787dd..775e3406da7 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -2159,21 +2159,23 @@ CGObjCCommonMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF,
const ObjCInterfaceDecl *ClassReceiver,
const ObjCCommonTypesHelper &ObjCTypes) {
CodeGenTypes &Types = CGM.getTypes();
- CallArgList ActualArgs;
- if (!IsSuper)
- Arg0 = CGF.Builder.CreateBitCast(Arg0, ObjCTypes.ObjectPtrTy);
- ActualArgs.add(RValue::get(Arg0), Arg0Ty);
+ auto selTy = CGF.getContext().getObjCSelType();
+ llvm::Value *SelValue;
+
if (Method && Method->isDirectMethod()) {
// Direct methods will synthesize the proper `_cmd` internally,
// so just don't bother with setting the `_cmd` argument.
assert(!IsSuper);
- auto selTy = CGF.getContext().getObjCSelType();
- auto undefSel = llvm::UndefValue::get(Types.ConvertType(selTy));
- ActualArgs.add(RValue::get(undefSel), selTy);
+ SelValue = llvm::UndefValue::get(Types.ConvertType(selTy));
} else {
- ActualArgs.add(RValue::get(GetSelector(CGF, Sel)),
- CGF.getContext().getObjCSelType());
+ SelValue = GetSelector(CGF, Sel);
}
+
+ CallArgList ActualArgs;
+ if (!IsSuper)
+ Arg0 = CGF.Builder.CreateBitCast(Arg0, ObjCTypes.ObjectPtrTy);
+ ActualArgs.add(RValue::get(Arg0), Arg0Ty);
+ ActualArgs.add(RValue::get(SelValue), selTy);
ActualArgs.addFrom(CallArgs);
// If we're calling a method, use the formal signature.
@@ -7622,7 +7624,7 @@ Address CGObjCNonFragileABIMac::EmitSelectorAddr(CodeGenFunction &CGF,
llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel),
ObjCTypes.SelectorPtrTy);
std::string SectionName =
- GetSectionName("__objc_selrefs", "literal_pointers");
+ GetSectionName("__objc_selrefs", "literal_pointers,no_dead_strip");
Entry = new llvm::GlobalVariable(
CGM.getModule(), ObjCTypes.SelectorPtrTy, false,
getLinkageTypeForObjCMetadata(CGM, SectionName), Casted,
Basically, I emit the selref before emiting Arg0 as it used to, to avoid having to change all the tests.
I also put the "no_dead_strip" on selector sections back, as it's a remnant from an old iteration and this change is not needed for this per se (if we mean to do it it should be its own change).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69991/new/
https://reviews.llvm.org/D69991
Files:
clang/include/clang/AST/DeclObjC.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/ObjCRuntime.h
clang/include/clang/Sema/DeclSpec.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/DeclObjC.cpp
clang/lib/AST/DeclPrinter.cpp
clang/lib/AST/JSONNodeDumper.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CGObjCRuntime.h
clang/lib/Parse/ParseObjc.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaObjCProperty.cpp
clang/test/CodeGenObjC/direct-method.m
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaObjC/method-direct-properties.m
clang/test/SemaObjC/method-direct.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69991.229743.patch
Type: text/x-patch
Size: 70233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191118/319d677a/attachment-0001.bin>
More information about the cfe-commits
mailing list