[PATCH] D135099: [C2x] Implement support for nullptr and nullptr_t

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 17:16:49 PDT 2022


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:8730
+  //   result also has that type.
+  if (LHSTy->isNullPtrType() && Context.hasSameType(LHSTy, RHSTy))
+    return ResTy;
----------------
erichkeane wrote:
> what does this do with the GNU ternary-thing?  
Does this cover if one is a pointer with a null pointer value?


================
Comment at: clang/lib/Sema/SemaExpr.cpp:12587
 
-    // Comparison of Objective-C pointers and block pointers against nullptr_t.
-    // These aren't covered by the composite pointer type rules.
-    if (!IsOrdered && RHSType->isNullPtrType() &&
-        (LHSType->isObjCObjectPointerType() || LHSType->isBlockPointerType())) {
+  // C++ [expr.eq]p4:
+  //   Two operands of type std::nullptr_t or one operand of type
----------------
This was in the `if (getLangOpts().CPlusPlus)` block previously, did you mean to move it out?


================
Comment at: clang/lib/Sema/SemaExpr.cpp:12620
+
+  // Comparison of Objective-C pointers and block pointers against nullptr_t.
+  // These aren't covered by the composite pointer type rules.
----------------
This was in the `if (getLangOpts().CPlusPlus)` block previously, did you mean to move it out?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135099/new/

https://reviews.llvm.org/D135099



More information about the cfe-commits mailing list