[PATCH] D89475: [SemaObjC] Fix composite pointer type calculation for `void*` and pointer to lifetime qualified ObjC pointer type
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 12:21:30 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG351317167e2b: [SemaObjC] Fix composite pointer type calculation for `void*` and pointer to… (authored by erik.pilkington).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89475/new/
https://reviews.llvm.org/D89475
Files:
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaObjCXX/arc-ptr-comparison.mm
Index: clang/test/SemaObjCXX/arc-ptr-comparison.mm
===================================================================
--- clang/test/SemaObjCXX/arc-ptr-comparison.mm
+++ clang/test/SemaObjCXX/arc-ptr-comparison.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -verify %s
// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -verify -DNOARC %s
#ifdef NOARC
// expected-no-diagnostics
@@ -51,3 +51,17 @@
return a == cv;
return ca == v;
}
+
+#ifndef NOARC
+int testDoublePtr(void *pv, void **ppv, A *__strong* pspa, A *__weak* pwpa, A *__strong** ppspa) {
+ return pv == pspa;
+ return pspa == pv;
+ return pv == pspa;
+ return pv == pwpa;
+ return pspa == pwpa; // expected-error {{comparison of distinct pointer types}}
+ return ppv == pspa; // expected-error {{comparison of distinct pointer types}}
+ return pspa == ppv; // expected-error {{comparison of distinct pointer types}}
+ return pv == ppspa;
+ return ppv == ppspa; // expected-error{{comparison of distinct pointer types}}
+}
+#endif
Index: clang/lib/Sema/SemaExprCXX.cpp
===================================================================
--- clang/lib/Sema/SemaExprCXX.cpp
+++ clang/lib/Sema/SemaExprCXX.cpp
@@ -6552,12 +6552,16 @@
// FIXME: In C, we merge __strong and none to __strong at the top level.
if (Q1.getObjCGCAttr() == Q2.getObjCGCAttr())
Quals.setObjCGCAttr(Q1.getObjCGCAttr());
+ else if (T1->isVoidPointerType() || T2->isVoidPointerType())
+ assert(Steps.size() == 1);
else
return QualType();
// Mismatched lifetime qualifiers never compatibly include each other.
if (Q1.getObjCLifetime() == Q2.getObjCLifetime())
Quals.setObjCLifetime(Q1.getObjCLifetime());
+ else if (T1->isVoidPointerType() || T2->isVoidPointerType())
+ assert(Steps.size() == 1);
else
return QualType();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89475.298440.patch
Type: text/x-patch
Size: 2077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201015/9ed31dee/attachment.bin>
More information about the cfe-commits
mailing list