[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-09 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/138673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138673 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread via cfe-commits
https://github.com/Sirraide edited https://github.com/llvm/llvm-project/pull/138673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread via cfe-commits
https://github.com/Sirraide approved this pull request. https://github.com/llvm/llvm-project/pull/138673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138673 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread via cfe-commits
https://github.com/Sirraide commented: It would be nice to also have tests to make sure we *do* emit the warning if the array is too large https://github.com/llvm/llvm-project/pull/138673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread via cfe-commits
Sirraide wrote: > I have not added the test since I thought it might take too long, but it's > probably not a problem since we do the check before even touching the array... Can’t you set the eval steps to like `100` or sth to avoid it taking too long or am I missing something here? https://g

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread Timm Baeder via cfe-commits
tbaederr wrote: That comment is obsolete, I've added two test cases that work https://github.com/llvm/llvm-project/pull/138673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread via cfe-commits
@@ -11919,6 +11924,11 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E, if (const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayType(Type)) { unsigned FinalSize = CAT->getZExtSize(); +if (!Info.CheckArraySize(E->getExprLoc(), +

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138673 >From 224ff74f7cd2460414c96e8b528e8f086535da5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 May 2025 12:36:24 +0200 Subject: [PATCH] [clang][ExprConst] Check for array size of initl

[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-06 Thread Timm Baeder via cfe-commits
tbaederr wrote: That fixes compile-time computation, but this example still breaks in codegen: ```c++ #include using namespace std; constexpr size_t kMemoryChunk = 1024 * 8; constexpr size_t kNumberOfIterations = 200; constexpr size_t kThreadsNumber = 2 * kMemoryChunk; struct S {}; int mai