[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-28 Thread Alexander Kornienko via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr alexfh wrote: Sure. Done in b509f7cca58c8db060eebea6fb5b28c3d0b3727b.

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-28 Thread Eli Friedman via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr efriedma-quic wrote: Maybe we can simplify it to just: ``` /// CK_Nu

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-28 Thread Alexander Kornienko via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr alexfh wrote: @efriedma-quic I'll land the fix now. Please let me kno

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-28 Thread Alexander Kornienko via cfe-commits
https://github.com/alexfh closed https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
https://github.com/alexfh updated https://github.com/llvm/llvm-project/pull/137364 >From 5431de1664814a7a2dcc93695eed8745ae6bfef5 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Fri, 25 Apr 2025 17:51:03 +0200 Subject: [PATCH 1/5] [CodeGen] Fix handling of nullptr in initializers Fixe

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr alexfh wrote: Okay, hopefully, I got it right this time. https://git

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
https://github.com/alexfh updated https://github.com/llvm/llvm-project/pull/137364 >From 5431de1664814a7a2dcc93695eed8745ae6bfef5 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Fri, 25 Apr 2025 17:51:03 +0200 Subject: [PATCH 1/4] [CodeGen] Fix handling of nullptr in initializers Fixe

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr rjmccall wrote: I think Eli is asking for you to note in the text tha

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Eli Friedman via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr efriedma-quic wrote: (Copy-pasting comment since I accidentally put i

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr alexfh wrote: Sorry, I misunderstood your previous comment. Now, is `

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s + +using ulong = unsigned long; +template +void g(Ts... args) { + ulong arr[3] = {ulong(args)...}; + (void)arr; +} +extern void f() { + g(nullptr, 17); +} + +// CHECK: {

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
https://github.com/alexfh updated https://github.com/llvm/llvm-project/pull/137364 >From 5431de1664814a7a2dcc93695eed8745ae6bfef5 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Fri, 25 Apr 2025 17:51:03 +0200 Subject: [PATCH 1/3] [CodeGen] Fix handling of nullptr in initializers Fixe

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Can you update the documentation for CK_NullToPointer so it notes the result can be a null pointer constant? (I guess it's the right cast kind, but it's not intuitive, so we should call it out.) https://github.com/llvm/llvm-project/pull/137364 _

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Alexander Kornienko (alexfh) Changes Fixes https://github.com/llvm/llvm-project/issues/137276. --- Full diff: https://github.com/llvm/llvm-project/pull/137364.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+4-2

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Alexander Kornienko (alexfh) Changes Fixes https://github.com/llvm/llvm-project/issues/137276. --- Full diff: https://github.com/llvm/llvm-project/pull/137364.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CodeGenTypes.c

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread Alexander Kornienko via cfe-commits
https://github.com/alexfh created https://github.com/llvm/llvm-project/pull/137364 Fixes https://github.com/llvm/llvm-project/issues/137276. >From 5431de1664814a7a2dcc93695eed8745ae6bfef5 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Fri, 25 Apr 2025 17:51:03 +0200 Subject: [PATCH]