[Sema] Handle objc_super special lookup when checking builtin compatibility

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.

Differential Revision: https://reviews.llvm.org/D87917
This commit is contained in:
Raul Tambre 2020-09-18 20:07:05 +03:00
parent 06fe76cc4f
commit a1aa330b20
2 changed files with 9 additions and 0 deletions

View File

@ -9671,6 +9671,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
NewFD->addAttr(BuiltinAttr::CreateImplicit(Context, BuiltinID));
} else {
ASTContext::GetBuiltinTypeError Error;
LookupPredefedObjCSuperType(*this, S, NewFD->getIdentifier());
QualType BuiltinType = Context.GetBuiltinType(BuiltinID, Error);
if (!Error && !BuiltinType.isNull() &&

View File

@ -0,0 +1,8 @@
// RUN: %clang_cc1 -verify %s
// expected-no-diagnostics
// objc_super has special lookup rules for compatibility with macOS headers, so
// the following should compile.
struct objc_super {};
extern "C" id objc_msgSendSuper(struct objc_super *super, SEL op, ...);
extern "C" void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...);