[clang] [clang] Implement `__is_pointer_interconvertible_base_of()` (PR #88473)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 23:03:02 PDT 2024


================
@@ -19710,6 +19710,27 @@ bool Sema::IsLayoutCompatible(QualType T1, QualType T2) const {
   return isLayoutCompatible(getASTContext(), T1, T2);
 }
 
+//===-------------- Pointer interconvertibility ----------------------------//
+
+bool Sema::IsPointerInterconvertibleBaseOf(const TypeSourceInfo *Base,
+                                           const TypeSourceInfo *Derived) {
+  QualType BaseT = Base->getType().getCanonicalType().getUnqualifiedType();
+  QualType DerivedT =
+      Derived->getType().getCanonicalType().getUnqualifiedType();
----------------
Sirraide wrote:

Wouldn’t just `getCanonicalTypeUnqualified()` do the same thing as `getCanonicalType().getUnqualifiedType()`—or is there a difference between the two that I’m not aware of?

https://github.com/llvm/llvm-project/pull/88473


More information about the cfe-commits mailing list