[clang] [clang][bytecode] Don't set OnePastEnd bit for array elements (PR #136422)

2025-04-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/136422 If we refer to arr[N], don't set the OnePastEnd bit of the APValue, since that is already encoded in the array index. >From 9e3abaa3711d1845c6b6669ba002570445d29116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim

[clang] [clang][bytecode] Diagnose failed MemberPtrPtr casts differently (PR #136407)

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

[clang] [clang][bytecode] Don't set OnePastEnd bit for array elements (PR #136422)

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

[clang] [clang][bytecode] Slightly optimize integral casts of literals (PR #138879)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/138879 We often see initializers like unsigned a = 10; which take an integer literal and immediately cast it to another type. Recognize this pattern and omit the cast, simply emitting the value as a different type

[clang] [clang][NFC] Use BuiltinType::isFloatingPoint() in Type::isFloatingType() (PR #139035)

2025-05-08 Thread Timm Baeder via cfe-commits
tbaederr wrote: I considered that the comparison is inlined in `isFloatingType` for performance reasons, but the git log doesn't suggest anything like that. https://github.com/llvm/llvm-project/pull/139035 ___ cfe-commits mailing list cfe-commits@list

[clang] [clang][bytecode] Reorder type checks in classify() (PR #139046)

2025-05-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/139046 Move the member pointer check further below and remove Complex/Vector type checks and instead rely on the final return to handle those. >From 7ec6c9f5508766ffa1860fe84ac7c0c2a7e64d8e Mon Sep 17 00:00:00 2001 F

[clang] [clang][bytecode] Slightly optimize integral casts of literals (PR #138879)

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

[clang] [clang][bytecode] Slightly optimize integral casts of literals (PR #138879)

2025-05-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138879 >From d20a16354c6f61ecb62ce68239eb3f94adc6f6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 May 2025 16:37:34 +0200 Subject: [PATCH] We often see initializers like unsigned a = 10;

[clang] [clang][ExprConstant] Bail out on invalid lambda capture inits (PR #138832)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/138832 Fixes https://github.com/llvm/llvm-project/issues/138824 >From 8534038ad80d5de9218f8f9663bef16cbcabd19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 May 2025 11:03:28 +0200 Subject

[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][ExprConstant] Bail out on invalid lambda capture inits (PR #138832)

2025-05-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138832 >From ba1c2ab6e90e603d3bb0545ff640ab07b524d656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 May 2025 11:03:28 +0200 Subject: [PATCH] [clang][ExprConstant] Bail out on invalid lambda

[clang] [clang][bytecode] Slightly optimize integral casts of literals (PR #138879)

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

[clang] [clang][bytecode] Slightly optimize integral casts of literals (PR #138879)

2025-05-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/138879 >From c06949b212d3ce4a09bb978d1e5eceb4f4a1b1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 May 2025 16:37:34 +0200 Subject: [PATCH] We often see initializers like unsigned a = 10;

[clang] [clang][bytecode] Fix returne value of array CXXNewExprs (PR #127526)

2025-02-17 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127526 Just like with the __builtin_operator_new version, we need to point to the first array element, not the array element itself. >From ba084758083d32d2db4773abd181880717830706 Mon Sep 17 00:00:00 2001 From: =?UTF

[clang] [clang][bytecode] Fix three-way unordered non-pointer comparisions (PR #127759)

2025-02-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127759 This _can_ happen with non-pointers, but we shouldn't diagnose it in that case. >From 1b4f4b78741e297e8d257af427206f3dbc3501d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 19 Feb 202

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2025-02-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67095 >From 1bb62210a2ec5342111a0407cbfa8a73d761357f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 22 Sep 2023 08:42:05 +0200 Subject: [PATCH] [clang][TSA] Make RequiresCapability a DeclOrTyp

[clang] [clang][bytecode] Fix three-way unordered non-pointer comparisions (PR #127759)

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

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2025-02-19 Thread Timm Baeder via cfe-commits
tbaederr wrote: One thing I'm unsure about right now: This probably needs more work, especially regarding assigning function pointers, doesn't it? Even in the test case I added right now, `Foo_fun2` is declared with `SHARED_LOCKS_REQUIRED(mu2) EXCLUSIVE_LOCKS_REQUIRED(mu1)`, but then the func

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2025-02-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67095 >From 354359e251ddb5cc4e77e7f78bfc6917d26f5f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 22 Sep 2023 08:42:05 +0200 Subject: [PATCH] [clang][TSA] Make RequiresCapability a DeclOrTyp

[clang] [clang][bytecode] Move bases and virtual bases in moveRecord (PR #127627)

2025-02-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127627 The fixme comment turned out to be true. >From 7fec903e68bc8a2803b2bfd51d47cc4723e24234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 18 Feb 2025 14:02:58 +0100 Subject: [PATCH] [clan

[clang] [clang][bytecode] Move bases and virtual bases in moveRecord (PR #127627)

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

[clang] [clang][bytecode] Allow up/down casts of nullptr (PR #127615)

2025-02-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127615 If the target type is a pointer type. >From c8593a44e4589cc5267070fbb7d9b758390ef792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 18 Feb 2025 11:49:02 +0100 Subject: [PATCH] [clang][

[clang] [clang][bytecode] Move bases and virtual bases in moveRecord (PR #127627)

2025-02-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/127627 >From af63ce3381c42e751896d2e544218da88f98c83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 18 Feb 2025 14:02:58 +0100 Subject: [PATCH] [clang][bytecode] Move bases and virtual bases

[clang] [clang][bytecode] Allow up/down casts of nullptr (PR #127615)

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

[clang] [clang][bytecode] Fix returne value of array CXXNewExprs (PR #127526)

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

[clang] [clang][bytecode] Fix allocating primitive arrays of unknown bound (PR #127788)

2025-02-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127788 None >From dff6bd91600617d7b631be09ff7c06c5a2fd5786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 19 Feb 2025 12:46:49 +0100 Subject: [PATCH] [clang][bytecode] Fix allocating primitiv

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-06 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/130143 >From 3bdebdee5bce1891b05807a78a639d72e72cd52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 6 Mar 2025 16:1

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/130143 >From 3bdebdee5bce1891b05807a78a639d72e72cd52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 6 Mar 2025 16:18:49 +0100 Subject: [PATCH] [clang][bytecode] Yet another __builtin_constant

[clang] [clang][bytecode] Implement __builtin_constant_p (PR #130143)

2025-03-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/130143 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reject constexpr-unknown values as constant expressions more consistently (PR #129952)

2025-03-07 Thread Timm Baeder via cfe-commits
@@ -154,3 +154,26 @@ int g() { static_assert(f(arr) == 5); } } + +namespace GH128409 { + int &ff(); + int &x = ff(); // nointerpreter-note {{declared here}} + constinit int &z = x; // expected-error {{variable does not have a constant initializer}} +

[clang] [clang][bytecode] Implement __builtin_constant_p (PR #130143)

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

[clang] [clang][bytecode] Loosen assertion This() for array elements (PR #130399)

2025-03-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130399 getRecord() returns null on array elements, even for composite arrays. The assertion here was overly restrictive and having an array element as instance pointer should be fine otherwise. >From a4327462a417aeb

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-07 Thread Timm Baeder via cfe-commits
tbaederr wrote: For this case: ```c++ constexpr bool test(int& i) { return __builtin_constant_p(i = 5); } constexpr int f() { int a = 10; test(a); return a; } static_assert(f() == 5); ``` I simply don't. This also works in GCC. For ```c++ bool test(int& i) { return __builtin_constant_p

[clang] [clang][bytecode] Special-case ConstantExpr in if conditions (PR #130294)

2025-03-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130294 This happens a lot with `if constexpr` with a condition based on a template param. In those cases, the condition is a ConstantExpr with a value already set, so we can use that and ignore the other branch. >Fr

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-07 Thread Timm Baeder via cfe-commits
tbaederr wrote: Yeah. I think I'll merge this. The implementation isn't _that_ invasive, so if any problem arises, it's not too bad to revert it again. https://github.com/llvm/llvm-project/pull/130143 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [clang][bytecode] Special-case ConstantExpr in if conditions (PR #130294)

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

[clang] [Clang] Implement P0963R3 "Structured binding declaration as a condition" (PR #130228)

2025-03-07 Thread Timm Baeder via cfe-commits
@@ -4285,6 +4290,8 @@ class DecompositionDecl final std::move(Bindings)); } + bool isDecisionVariable() const { return IsDecisionVariable; } tbaederr wrote: Can you add docs here explaining what this means? http

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/130143 >From dd4291322d7f00c4110ac64b6e39b0349d1122c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 6 Mar 2025 16:18:49 +0100 Subject: [PATCH] [clang][bytecode] Yet another __builtin_constant

[clang] [clang] Allow relational comparisons between unequal pointers to `void` in constant expressions (PR #89449)

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

[clang] [clang][bytecode] Implement __builtin_{memchr,strchr,char_memchr} (PR #130420)

2025-03-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130420 llvm has recently started to use `__builitn_memchr` at compile time, so implement this. Still needs some work but the basics are done. >From 956594d8c47169a9f45eb2aae03085f79d295390 Mon Sep 17 00:00:00 2001 Fr

[clang] [clang][bytecode] Implement __builtin_{memchr,strchr,char_memchr} (PR #130420)

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

[clang] [clang][bytecode] Surround bcp condition with Start/EndSpeculation (PR #130427)

2025-03-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130427 This is similar to what the current interpreter is doing - the FoldConstant RAII object surrounds the entire HandleConditionalOperator call, which means the condition and both TrueExpr or FalseExpr. >From ad5

[clang] [clang][bytecode] Surround bcp condition with Start/EndSpeculation (PR #130427)

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

[clang] [clang][bytecode][NFC] Bail out on non constant evaluated builtins (PR #130431)

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

[clang] [clang][bytecode] Loosen assertion This() for array elements (PR #130399)

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

[clang] [clang][bytecode][NFC] Check conditional op condition for ConstantExprs (PR #130425)

2025-03-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130425 Same thing we now do in if statements. Check the condition of a conditional operator for a statically known true/false value. >From 6543c75f7b5ea03b6061637f18b8a97c3ce48410 Mon Sep 17 00:00:00 2001 From: =?UTF

[clang] [clang][bytecode][NFC] Check conditional op condition for ConstantExprs (PR #130425)

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

[clang] [clang][bytecode][NFC] Bail out on non constant evaluated builtins (PR #130431)

2025-03-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130431 If the ASTContext says so, don't bother trying to constant evaluate the given builtin. >From 1a085cf37983ca5acef83939371a5fee9d5f1813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 8

[clang] [clang][bytecode] Implement __builtin_{memchr,strchr,char_memchr} (PR #130420)

2025-03-09 Thread Timm Baeder via cfe-commits
@@ -1960,13 +1960,103 @@ static bool interp__builtin_memcmp(InterpState &S, CodePtr OpPC, // However, if we read all the available bytes but were instructed to read // even more, diagnose this as a "read of dereferenced one-past-the-end - // pointer". This is what would

[clang] [clang][NFC] Clean up Expr::EvaluateAsConstantExpr (PR #130498)

2025-03-09 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130498 The Info.EnableNewConstInterp case is already handled above. >From c3a736fbd6f6844053c31fc4599053d1ed647706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 9 Mar 2025 18:05:48 +0100 Sub

[clang] [clang][bytecode] Fix getting pointer element type in __builtin_memcmp (PR #130485)

2025-03-09 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130485 When such a pointer is heap allocated, the type we get is a pointer type. Take the pointee type in that case. >From eb19b865be45021df556d5dfa247abfb6e129e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3

[clang] [clang][bytecode] Fix getting pointer element type in __builtin_memcmp (PR #130485)

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

[clang] [clang][bytecode] Fix a crash in CheckConstantExpression (PR #129752)

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

[clang] [clang] Reject constexpr-unknown values as constant expressions more consistently (PR #129952)

2025-03-05 Thread Timm Baeder via cfe-commits
@@ -154,3 +154,26 @@ int g() { static_assert(f(arr) == 5); } } + +namespace GH128409 { + int &ff(); + int &x = ff(); // nointerpreter-note {{declared here}} + constinit int &z = x; // expected-error {{variable does not have a constant initializer}} tbae

[clang] [clang] Reject constexpr-unknown values as constant expressions more consistently (PR #129952)

2025-03-05 Thread Timm Baeder via cfe-commits
@@ -154,3 +154,26 @@ int g() { static_assert(f(arr) == 5); } } + +namespace GH128409 { + int &ff(); + int &x = ff(); // nointerpreter-note {{declared here}} + constinit int &z = x; // expected-error {{variable does not have a constant initializer}} +

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130143 I think this is the one. Patch needs a little cleanup and documentation, which I'll do later. I'll also later add the test results. For now, check the CI once. >From 61da70b5a1df38d66ba93ca49093d0802e7ef1b3 M

[clang] [clang][bytecode] Yet another __builtin_constant_p implementation (PR #130143)

2025-03-06 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/130143 >From 3bdebdee5bce1891b05807a78a639d72e72cd52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 6 Mar 2025 16:18:49 +0100 Subject: [PATC

[clang] disable unary, vector mask (PR #130400)

2025-03-10 Thread Timm Baeder via cfe-commits
tbaederr wrote: You can see two test failures in the CI output above. https://github.com/llvm/llvm-project/pull/130400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix builtin_memcmp buffer sizes for pointers (PR #130570)

2025-03-10 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/130570 >From 94cc40f43efa0bb1bf0b361d9b160ca70d43e27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 10 Mar 2025 11:00:54 +0100 Subject: [PATCH] [clang][bytecode] Fix builtin_memcmp buffer siz

[clang] [clang][bytecode] Fix builtin_memcmp buffer sizes for pointers (PR #130570)

2025-03-10 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/130570 Don't use the pointer size, but the number of elements multiplied by the element size. >From 179cb3f3b27b288d4352353f3ae98929f1f465c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 10

[clang] [clang][bytecode] Fix builtin_memcmp buffer sizes for pointers (PR #130570)

2025-03-11 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,120 @@ +// RUN: %clang_cc1 -std=c++2c -fexperimental-new-constant-interpreter -verify=expected,both %s +// RUN: %clang_cc1 -std=c++2c -verify=ref,both %s + +// both-no-diagnostics + +namespace std { +inline namespace { tbaederr wrote: Oh, no meaning

[clang] [clang][NFC] Clean up Expr::EvaluateAsConstantExpr (PR #130498)

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

[clang] [clang][bytecode] Fix builtin_memcmp buffer sizes for pointers (PR #130570)

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

[clang] [clang][bytecode] Explicitly composite array descriptor types (PR #129376)

2025-03-01 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/129376 When creating descriptor for array element types, we only save the original source, e.g. int[2][2][2]. So later calls to getType() of the element descriptors will also return int[2][2][2], instead of e.g. int[

[clang] [clang-tools-extra] [clang] improve class type sugar preservation in pointers to members (PR #130537)

2025-03-11 Thread Timm Baeder via cfe-commits
tbaederr wrote: Could you run this through the compile time tracker? https://github.com/llvm/llvm-project/pull/130537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode][NFC] Fix getting references to local function ptrs (PR #129852)

2025-03-05 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/129852 This is the same thing we do for globals and parameters. >From 9f71da5ed2b6dfa7ec26b1b0b5a51a713edeee4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 5 Mar 2025 10:01:39 +0100 Subject

[clang] [clang][bytecode][NFC] Fix getting references to local function ptrs (PR #129852)

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

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-03-05 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: tbaederr wrote: Ping https://github.com/llvm/llvm-project/pull/128732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Ignore function calls with depth > 0... (PR #129887)

2025-03-05 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/129887 ... when checking for a potential constant expression. This is also what the current interpreter does. >From 8e4267678319e98b2119233e13b5e73869bc3a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?

[clang] [clang][bytecode] Ignore function calls with depth > 0... (PR #129887)

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

[clang] [clang][bytecode] Fix rejecting non-constexpr array ctors (PR #127448)

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

[clang] [clang][bytecode] Restructure Program::CurrentDeclaration handling (PR #127456)

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

[clang] [clang][bytecode] Restructure Program::CurrentDeclaration handling (PR #127456)

2025-02-17 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127456 Properly reset to the last ID and return the current ID from getCurrentDecl(). >From 9f40e18f792c8307464f7acf75f5ec9376318d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 17 Feb 2025

[clang] [clang] handle fp options in __builtin_convertvector (PR #125522)

2025-02-16 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/125522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix const-ness of local primitive temporary (PR #127405)

2025-02-16 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/127405 This used to cause certain std::range tests in libc++ to be diagnosed as modifying a const-qualified field, because we set the IsConst flag to true unconditionally. Check the type instead. >From 81d9f2d55463f

[clang] [clang][bytecode] Use ExtendingDecl mechanism for primitives as well (PR #128141)

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

[clang] [clang][bytecode] Use ExtendingDecl mechanism for primitives as well (PR #128141)

2025-02-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128141 ... when creating the temporary variables for a MaterializeTemporaryExpr. >From c097cff3502bf0fbbbd2a1c8c791f578fd1ce507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Feb 2025 20:2

[clang] [clang][bytecode] Silently reject ctors of invalid decls (PR #128290)

2025-02-21 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128290 The follow-up diagnostic would otherwise be: array.cpp:111:33: note: undefined constructor '(unnamed struct at array.cpp:111:11)' cannot be used in a constant expression array.cpp:111:11: note: declared here

[clang] [clang][bytecode] Silently reject ctors of invalid decls (PR #128290)

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

[clang] [clang][bytecode] Always reject ctors of invalid parent decls (PR #128295)

2025-02-21 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128295 The copy constructor of an invalid declaration might still be perfectly valid, but we still need to reject it. >From 0dbe55f8a54048ea381ce39e641921c2a923475f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C

[clang] [clang][bytecode] Fix delete[] dtor order (PR #128411)

2025-02-23 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128411 As always, call array dtors in reverse order. >From c8d9fba32d6c97e89d320533fd680f6fa2f80a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 23 Feb 2025 10:57:47 +0100 Subject: [PATCH]

[clang] [clang][bytecode] Reject calls to pure virtual functions (PR #128412)

2025-02-23 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128412 None >From 5bb0213254e070c3c24492d6b7ec6810b13f5455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 23 Feb 2025 11:10:43 +0100 Subject: [PATCH] [clang][bytecode] Reject calls to pure vi

[clang] [clang][bytecode] Always reject ctors of invalid parent decls (PR #128295)

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

[clang] [clang][bytecode] Handle non-primitive array index expressions (PR #128479)

2025-02-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128479 By rejecting them instead of asserting in `classifyPrim()`. >From 5fc1574ccca3303b936f7fba0a0e8e1a0707a6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 24 Feb 2025 09:05:17 +0100 Sub

[clang] [clang][bytecode] Handle non-primitive array index expressions (PR #128479)

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

[clang] [clang][bytecode] Expand subscript base if of pointer type (PR #128511)

2025-02-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128511 This is similar to what we do in the AddOffset instruction when adding an offset to a pointer. >From dd05a8c4c2a8d23b294723c554a33b65080a2367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date:

[clang] [clang][bytecode] Reject calls to pure virtual functions (PR #128412)

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

[clang] [clang][bytecode] Fix delete[] dtor order (PR #128411)

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

[clang] [clang][bytecode] Handle UsingDirectiveDecls (PR #128888)

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

[clang] [clang][bytecode] Handle UsingDirectiveDecls (PR #128888)

2025-02-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/12 By ignoring them. >From 77ec128a7f6bfc92824d0b30e93916dd6a23949a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 26 Feb 2025 16:03:32 +0100 Subject: [PATCH] [clang][bytecode] Handle Usi

[clang] [clang][bytecode][NFC] Add missing LLVM_PREFERRED_TYPE to bitfield (PR #128740)

2025-02-25 Thread Timm Baeder via cfe-commits
tbaederr wrote: > LGTM but please add a more detailed summary something along the lines of > `Added LLVM_PREFERRED_TYPE to InUnion field of InlineDescriptor` would be > sufficient. Does this help at all? The patch is pretty obvious and I don't think it clears things up if I explain a single-l

[clang] [clang][bytecode] Fix initing incomplete arrays from ImplicitValueIni… (PR #128729)

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

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-02-25 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/128732 >From 87209d26acf78f2566a7d1e9fd6dee7f455b4e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 25 Feb 2025 17:14:36 +0100 Subject: [PAT

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-02-25 Thread Timm Baeder via cfe-commits
@@ -504,4 +504,39 @@ namespace AnonymousUnion { static_assert(return_init_all().a.p == 7); // both-error {{}} \ // both-note {{read of member 'p' of union with no active member}} } + +namespace InactiveDestroy { + struct A { +

[clang] [clang][bytecode][NFC] Add missing LLVM_PREFERRED_TYPE to bitfield (PR #128740)

2025-02-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128740 None >From 885497707921ba8dd91164e1698b655cad965946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 25 Feb 2025 17:38:44 +0100 Subject: [PATCH] [clang][bytecode][NFC] Add missing LLVM_P

[clang] [clang][bytecode] Fix initing incomplete arrays from ImplicitValueIni… (PR #128729)

2025-02-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128729 …tExpr If the ImplicitValueInitExpr is of incomplete array type, we ignore it in its Visit function. This is a special case here, so pull out the element type and zero the elements. >From 86c68bb2af543829af3

[clang] [clang][bytecode] Add special case for anonymous unions (PR #128681)

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

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-02-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128732 And diagnose if we're trying to destroy an inactive member of a union. >From 87209d26acf78f2566a7d1e9fd6dee7f455b4e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 25 Feb 2025 17:14:3

[clang] [clang][bytecode] Return Invalid() on non-constexpr builtins (PR #133700)

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

[clang] [clang][bytecode] Reject constexpr-unknown values from comparisons (PR #133701)

2025-03-31 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/133701 None >From e941603c6b2da5c6ef30f8d62679e0ba6eb577c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 26 Mar 2025 16:23:43 +0100 Subject: [PATCH] [clang][bytecode] Reject constexpr-unknow

<    20   21   22   23   24   25   26   27   >