Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,8 @@ Bug Fixes to Compiler Builtins

- Fix ``__builtin_source_location`` incorrectly returning wrong column for method chains. (#GH119129)

- The behvaiour of ``__add_pointer`` and ``__remove_pointer`` for Objective-C++'s ``id`` and interfaces has been fixed.

Bug Fixes to Attribute Support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,8 @@ QualType Sema::BuildPointerType(QualType T,
if (checkQualifiedFunction(*this, T, Loc, QFK_Pointer))
return QualType();

assert(!T->isObjCObjectType() && "Should build ObjCObjectPointerType");
if (T->isObjCObjectType())
return Context.getObjCObjectPointerType(T);

// In ARC, it is forbidden to build pointers to unqualified pointers.
if (getLangOpts().ObjCAutoRefCount)
Expand Down Expand Up @@ -9808,8 +9809,7 @@ QualType Sema::BuiltinAddPointer(QualType BaseType, SourceLocation Loc) {
}

QualType Sema::BuiltinRemovePointer(QualType BaseType, SourceLocation Loc) {
// We don't want block pointers or ObjectiveC's id type.
if (!BaseType->isAnyPointerType() || BaseType->isObjCIdType())
if (!BaseType->isAnyPointerType())
return BaseType;

return BaseType->getPointeeType();
Expand Down
8 changes: 0 additions & 8 deletions clang/test/SemaCXX/remove_pointer.mm

This file was deleted.

17 changes: 17 additions & 0 deletions clang/test/SemaObjCXX/type-traits.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++17 %s

// expected-no-diagnostics

@interface I;
@end

@class C;

static_assert(__is_same(__add_pointer(id), id*));
static_assert(__is_same(__add_pointer(I), I*));

static_assert(__is_same(__remove_pointer(C*), C));
static_assert(!__is_same(__remove_pointer(id), id));
static_assert(__is_same(__remove_pointer(id*), id));
static_assert(__is_same(__remove_pointer(__add_pointer(id)), id));
static_assert(__is_same(__add_pointer(__remove_pointer(id)), id));
Loading