This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Handle objc_super special lookup when checking builtin compatibility
ClosedPublic

Authored by tambre on Sep 18 2020, 10:11 AM.

Details

Summary

objc_super is special and needs LookupPredefedObjCSuperType() called before performing builtin type comparisons.
This fixes an error when compiling macOS headers. A test is added.

Diff Detail

Event Timeline

tambre created this revision.Sep 18 2020, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 18 2020, 10:11 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tambre requested review of this revision.Sep 18 2020, 10:11 AM
tambre added a comment.EditedSep 18 2020, 10:14 AM

I'll go ahead and commit this after the builds pass, as it's affecting an user and the fix is simple and obvious. Hopefully post-commit review is acceptable per my understanding of the rules.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 18 2020, 10:52 AM
This revision was automatically updated to reflect the committed changes.

Thanks, this fixes the specific translation unit I was looking at today. It's going to take some time before I have full build results but I don't expect any problems.

rjmccall added inline comments.Sep 18 2020, 11:05 AM
clang/lib/Sema/SemaDecl.cpp
9674

Can we avoid doing this except for the small number of builtins that use struct objc_super? We already have the BuiltinID.

tambre added inline comments.Sep 18 2020, 11:09 AM
clang/lib/Sema/SemaDecl.cpp
9674

LookupPredefedObjCSuperType() already checks if the identifier is "objc_msgSendSuper". But it'd probably be more efficient to check the BuiltinID. I'll follow this up tomorrow.

Oh, I didn't notice that this only did work conditionally based on the builtin ID. Yes, please make a function like lookupNecessaryTypesForBuiltin that takes the builtin ID. Maybe we can generalize this to solve the problem with that other builtin, too.