[PATCH] D156175: [clang][ConstExprEmitter] handle NullToPointer ImplicitCastExpr

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 15:05:18 PDT 2023


nickdesaulniers updated this revision to Diff 544113.
nickdesaulniers marked 2 inline comments as done.
nickdesaulniers added a comment.

- remove the check for isNullValue as per @efriedma


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156175

Files:
  clang/lib/CodeGen/CGExprConstant.cpp


Index: clang/lib/CodeGen/CGExprConstant.cpp
===================================================================
--- clang/lib/CodeGen/CGExprConstant.cpp
+++ clang/lib/CodeGen/CGExprConstant.cpp
@@ -1127,6 +1127,12 @@
     case CK_ConstructorConversion:
       return Visit(subExpr, destType);
 
+    case CK_NullToPointer: {
+      if (llvm::Constant *C = Visit(subExpr, destType))
+        return CGM.EmitNullConstant(destType);
+      return nullptr;
+    }
+
     case CK_IntToOCLSampler:
       llvm_unreachable("global sampler variables are not generated");
 
@@ -1183,7 +1189,6 @@
     case CK_IntegralComplexToFloatingComplex:
     case CK_PointerToIntegral:
     case CK_PointerToBoolean:
-    case CK_NullToPointer:
     case CK_IntegralCast:
     case CK_BooleanToSignedIntegral:
     case CK_IntegralToPointer:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156175.544113.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/438a9b53/attachment.bin>


More information about the cfe-commits mailing list