[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-21 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-21 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/113885 >From 3005da1e2d25f124466743e5f7a5fc5b969f5740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 28 Oct 2024 10:04:46 +0100 Subject: [PAT

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-20 Thread Richard Smith via cfe-commits
https://github.com/zygoloid approved this pull request. LG, thank you! https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-20 Thread Timm Baeder via cfe-commits
tbaederr wrote: I think I understand what you mean by changing the order now. I changed two other places as well, just to be consistent. https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/113885 >From de066be9c6d62bb17d50ddbff40d04cda40a2f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 28 Oct 2024 10:04:46 +0100 Subject: [PATCH] [clang][ExprConst] Reject field access with nul

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-19 Thread Richard Smith via cfe-commits
zygoloid wrote: As mentioned in the comment thread, I'd prefer to see this addressed by reversing the order in which we call `addDecl` versus add an offset. While it's a corner case, I think this change would cause us to start rejecting things like [this example](https://godbolt.org/z/5Pae6Ghd

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-08 Thread Timm Baeder via cfe-commits
tbaederr wrote: @zygoloid Do you approve too? https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM but the changes should come with a release note. https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-11-05 Thread Timm Baeder via cfe-commits
tbaederr wrote: Ping https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-29 Thread Timm Baeder via cfe-commits
@@ -1703,7 +1703,7 @@ namespace { bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) { if (Designator.Invalid) return false; - if (IsNullPtr) { + if (getLValueBase().isNull()) { tbaederr wrote: Looks like the check here

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-29 Thread Timm Baeder via cfe-commits
@@ -1703,7 +1703,7 @@ namespace { bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) { if (Designator.Invalid) return false; - if (IsNullPtr) { + if (getLValueBase().isNull()) { tbaederr wrote: The offset is added in `a

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-28 Thread Richard Smith via cfe-commits
@@ -1703,7 +1703,7 @@ namespace { bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) { if (Designator.Invalid) return false; - if (IsNullPtr) { + if (getLValueBase().isNull()) { zygoloid wrote: Oh, I see. We're adjustin

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-28 Thread Richard Smith via cfe-commits
@@ -1703,7 +1703,7 @@ namespace { bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) { if (Designator.Invalid) return false; - if (IsNullPtr) { + if (getLValueBase().isNull()) { zygoloid wrote: Why was the old check not

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/113885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changes Reject them if the base is null, not only if the entire pointer is null. --- Full diff: https://github.com/llvm/llvm-project/pull/113885.diff 2 Files Affected: - (modified) clang/lib/AST/ExprConstant.cpp (

[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

2024-10-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/113885 Reject them if the base is null, not only if the entire pointer is null. >From 66d42412ddd22e0e4da293990d16a4d7692f973c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 28 Oct 2024 10:04