aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Tambre <raul.tambre@cleveron.com>2020-09-18 20:07:05 +0300
committerTom Stellard <tstellar@redhat.com>2020-12-14 19:43:12 -0500
commitfdab756331f322a9818c1bdf14d23d9cd6036c81 (patch)
tree400440c4d40106274a2c3d597e8361a1b1c06691
parentadf845300c9cc023d386d97b6ebeb1e82bd97763 (diff)
downloadllvm-fdab756331f322a9818c1bdf14d23d9cd6036c81.zip
llvm-fdab756331f322a9818c1bdf14d23d9cd6036c81.tar.gz
llvm-fdab756331f322a9818c1bdf14d23d9cd6036c81.tar.bz2
[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
-rw-r--r--clang/lib/Sema/SemaDecl.cpp1
-rw-r--r--clang/test/SemaObjCXX/builtin-objcsuper.mm8
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2703d98..82c78e3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9643,6 +9643,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() &&
diff --git a/clang/test/SemaObjCXX/builtin-objcsuper.mm b/clang/test/SemaObjCXX/builtin-objcsuper.mm
new file mode 100644
index 0000000..a6baf3c5
--- /dev/null
+++ b/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, ...);