[PATCH] D87917: [Sema] Handle objc_super special lookup when checking builtin compatibility

Raul Tambre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 10:11:16 PDT 2020


tambre created this revision.
tambre added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
tambre requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87917

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaObjCXX/builtin-objcsuper.mm


Index: clang/test/SemaObjCXX/builtin-objcsuper.mm
===================================================================
--- /dev/null
+++ clang/test/SemaObjCXX/builtin-objcsuper.mm
@@ -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, ...);
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -9671,6 +9671,7 @@
             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() &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87917.292836.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200918/0c98fa1e/attachment.bin>


More information about the cfe-commits mailing list