[clang] [clang][bytecode] Start implementing fixed point types (PR #110216)

2024-09-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/110216 >From 0b599fcfe648f46e9421621a23726f784f2ac1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 27 Sep 2024 09:44:30 +0200 Subject: [PATCH] [clang][bytecode] Start implementing fixed poin

[clang] [clang][bytecode] Implement zero-init for fixed point types (PR #110257)

2024-09-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110257 None >From 7f5e19784e83f28f54191377cf7b476e93453753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 27 Sep 2024 14:51:12 +0200 Subject: [PATCH] [clang][bytecode] Implement zero-init for

[clang] [clang][bytecode] Don't produce a null type when checking new exprs (PR #110252)

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

[clang] [clang][bytecode] Implement integral-to-fixed-point casts (PR #110350)

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

[clang] [clang][bytecode] Implement (N)EQ between fixed point and integral (PR #110358)

2024-09-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110358 Convert the non-fixed-point side to a fixed-point type before doing the comparison. >From a00e1ed99bd3f02af5131e2cf32c665608650a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 28 Se

[clang] [clang][bytecode] Implement zero-init for fixed point types (PR #110257)

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

[clang] [clang][bytecode] Implement integral-to-fixed-point casts (PR #110350)

2024-09-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110350 None >From 164521d666e573789b720d457c6c42809224e905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 27 Sep 2024 20:24:52 +0200 Subject: [PATCH] [clang][bytecode] Implement integral-to-f

[clang] [clang][bytecode] Implement fixed point casts (PR #110409)

2024-09-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110409 None >From 591335042fa3d0bb0fa732ece33a29e2b3565530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 07:52:29 +0200 Subject: [PATCH] [clang][bytecode] Implement fixed point c

[clang] [clang][bytcode] Convert Fixed Point values to target semantics... (PR #110411)

2024-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110411 ... after a binary operation. The Result of the operation is in the common semantics of RHS and LHS, so we need to convert that to the semantics of the BinaryOperator expression. >From 14e89ad5254e9457b01fc0c

[clang] [clang][bytecode] Implement fixed point casts (PR #110409)

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

[clang] [clang][bytecode] Implement fixed-point-to-int casts (PR #110417)

2024-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110417 And some cleanups around overflow handling. >From 20b0c417f53bc3c2094ee2f37c0aae150d7a1932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 10:53:44 +0200 Subject: [PATCH] [c

[clang] [clang][bytecode] Implement fixed-point-to-int casts (PR #110417)

2024-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/110417 >From a9fe3b63db4ecbcc1e86be3a087e4f3325c7cc03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 10:53:44 +0200 Subject: [PATCH] [clang][bytecode] Implement fixed-point-to-int

[clang] [clang][bytecode] Implement more binary operators for fixed point types (PR #110423)

2024-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110423 None >From d3142de6b640915ce69c4a11edc50a241949eccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 14:18:26 +0200 Subject: [PATCH] [clang][bytecode] Implement more binary o

[clang] [clang][bytecode] Implement more binary operators for fixed point types (PR #110423)

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

[clang] [clang][bytecode] Implement fixed-point-to-int casts (PR #110417)

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

[clang] [clang][bytecode] Implement fixed-point shifts (PR #110429)

2024-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110429 None >From c3ae3ce5d129f9c2655ea291c57cc3009ed31b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 18:38:52 +0200 Subject: [PATCH] [clang][bytecode] Implement fixed-point s

[clang] [clang][bytecode] Implement fixed-point add (PR #110405)

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

[clang] [clang][bytecode] Implement fixed-point add (PR #110405)

2024-09-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110405 None >From 58de93b574d2b8e47d830b79a136521c10eca1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 29 Sep 2024 06:12:01 +0200 Subject: [PATCH] [clang][bytecode] Implement fixed-point a

[clang] [clang][bytcode] Convert Fixed Point values to target semantics... (PR #110411)

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

[clang] [clang][bytecode] Implement fixed-point shifts (PR #110429)

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

[clang] [clang][ExprConst] Explicitly reject dependent types without diagnostic (PR #108598)

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

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Timm Baeder via cfe-commits
@@ -108,22 +108,16 @@ constexpr auto p2 = "test2"; constexpr bool b1 = foo(p1) == foo(p1); static_assert(b1); -constexpr bool b2 = foo(p1) == foo(p2); // ref-error {{must be initialized by a constant expression}} \ -// ref-note {{compar

[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

2024-09-19 Thread Timm Baeder via cfe-commits
@@ -2142,11 +2150,91 @@ static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } -static bool IsLiteralLValue(const LValue &Value) { - if (Value.getLValueCallIndex()) +// Information about an LValueBase that is some kind of string. +st

[clang] [clang][bytecode] Implement arithmetic, bitwise and compound assignment operator (PR #108949)

2024-09-19 Thread Timm Baeder via cfe-commits
tbaederr wrote: Same question for regular binary operators: ```c++ using VI __attribute__((ext_vector_type(4))) = int; constexpr int a() { VI a = {0, 0, 0, 0}; VI b = {1,1,1,1}; VI C = (a + b); return 0; } static_assert(a() == 0); ``` Also, might make sense to add them to `tes

[clang] [clang][bytecode] Fix a problem with array size limits (PR #109383)

2024-09-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/109383 Descriptor::MaxArrayElemBytes is an unsigned value, which might overflow the SizeT we have in CheckArraySize. >From 091ba215597e2fc41b3860182ae2136bcac7f5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3

[clang] [clang][bytecode] Fix a problem with array size limits (PR #109383)

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

[clang] [clang][bytecode] Implement arithmetic, bitwise and compound assignment operator (PR #108949)

2024-09-19 Thread Timm Baeder via cfe-commits
@@ -1281,26 +1277,67 @@ bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { const Expr *LHS = E->getLHS(); const Expr *RHS = E->getRHS(); const auto *VecTy = E->getType()->getAs(); + auto Op = E->isCompoundAssignmentOp() +? BinaryOperator::getOpFo

[clang] [clang][bytecode] Use field descriptor in IntPointer::atOffset (PR #109238)

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

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 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/67520 >From 5f411735a5366499481c09a317aa170af44796f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:3

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Updated the branch. This now warns: ```c++ #define LOCKABLE__attribute__ ((lockable)) #define EXCLUSIVE_LOCKS_REQUIRED(...) __attribute__ ((exclusive_locks_required(__VA_ARGS__))) struct L

[clang] [clang][bytecode] Implement ia32_bextr builitns (PR #110513)

2024-09-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110513 None >From 73e8f295b39674ed300534d85872fc0ba4821a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 30 Sep 2024 16:08:07 +0200 Subject: [PATCH] [clang][bytecode] Implement ia32_bextr bu

[clang] [Clang][TableGen] Change Opcodes Emitter to use const Record * (PR #110588)

2024-09-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/110588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: > So the semantics here are: if there is any `requires_capability` attribute on > a function, it needs to exactly match the set of `requires_capability` > attributes on every previous declaration? Or in

[clang] [clang][bytecode] Protect ia32_{lzcnt,tzcnt} against non-integers (PR #110699)

2024-10-01 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110699 These are also called for vectors. >From 4c7c6d3707e533d8300a622be6e02bf21b07e46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 1 Oct 2024 18:39:33 +0200 Subject: [PATCH] [clang][byte

[clang] [clang][bytecode] Implement ia32_bextr builitns (PR #110513)

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

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Moved it back into `ThreadAnalysis.cpp`. I'm still only comparing the number of args, but I'd like better diagnostics for this. I

[clang] [clang][bytecode] Check GetPtrBase ops for null pointers (PR #110673)

2024-10-01 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110673 None >From 43fdc0a7ea6b28bfad77d88e9d727e7752edb9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 1 Oct 2024 15:32:19 +0200 Subject: [PATCH] [clang][bytecode] Check GetPtrBase ops for

[clang] [clang][bytecode] Check GetPtrBase ops for null pointers (PR #110673)

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

[clang] [clang][bytecode] Implement ia32_{pdep, pext} builtins (PR #110675)

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

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , 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/67520 >From 1c117257921fc1c246fbb9f51e3c95d6dc6d295e Mon Sep 17 00:

[clang] [clang][bytecode] Implement ia32_{pdep, pext} builtins (PR #110675)

2024-10-01 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/110675 None >From e57f67c73af56e510943612e4eff651838706b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 1 Oct 2024 15:41:43 +0200 Subject: [PATCH] [clang][bytecode] Implement ia32_{pdep,pex

[clang] [clang][bytecode] Diagnose loads from weak variables (PR #109256)

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

[clang] [clang][bytecode] Implement arithmetic, bitwise and compound assignment operator (PR #108949)

2024-09-19 Thread Timm Baeder via cfe-commits
@@ -1267,12 +1267,8 @@ bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { assert(E->getLHS()->getType()->isVectorType()); assert(E->getRHS()->getType()->isVectorType()); - // FIXME: Current only support comparison binary operator, add support for - // other bina

[clang] [clang][bytecode] Implement arithmetic, bitwise and compound assignment operator (PR #108949)

2024-09-19 Thread Timm Baeder via cfe-commits
tbaederr wrote: Does it work to _not_ discard the result of a compound operator? ```c++ using VI __attribute__((ext_vector_type(4))) = int; constexpr int a() { VI a = {0, 0, 0, 0}; VI b = {1,1,1,1}; VI C = (a += b); return 0; } static_assert(a() == 0); ``` https://github.c

[clang] [clang][bytecode] Diagnose loads from weak variables (PR #109256)

2024-09-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/109256 None >From dd54314e7fca35feb4ae8d00687544990284d18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 19 Sep 2024 10:08:10 +0200 Subject: [PATCH] [clang][bytecode] Diagnose loads from wea

[clang] [clang][bytecode] Use field descriptor in IntPointer::atOffset (PR #109238)

2024-09-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/109238 We're otherwise still pointing to the old type, but with the new offset. >From aa2c3e286ec40d6897e17df6b2dd93553f93159c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 19 Sep 2024 07:47

[clang] [clang][bytecode] Ignore CPointerToObjCPointerCasts (PR #109760)

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

[clang] [clang][bytecode] Override InConstantContext flag for immediate calls (PR #109967)

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

[clang] [clang][bytecode] Override InConstantContext flag for immediate calls (PR #109967)

2024-09-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/109967 >From 29429e66580e242c4e6f1a9a86e9c0a5182b72fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 25 Sep 2024 13:50:19 +0200 Subject: [PATCH] [clang][bytecode] Override InConstantContext fl

[clang] [clang] Implement constexpr __builtin_bit_cast for complex types (PR #109981)

2024-09-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/109981 Fixes https://github.com/llvm/llvm-project/issues/94620 >From 12f625a2c7cf39285eac05f9aa294f3017931c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 25 Sep 2024 15:45:06 +0200 Subject

[clang] [clang] Implement constexpr __builtin_bit_cast for complex types (PR #109981)

2024-09-25 Thread Timm Baeder via cfe-commits
tbaederr wrote: I was going to add tests for floating complex types as well but I see that's rather hard and tests for floating types are rare in that file overall. https://github.com/llvm/llvm-project/pull/109981 ___ cfe-commits mailing list cfe-comm

[clang] [clang][bytecode] Override InConstantContext flag for immediate calls (PR #109967)

2024-09-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/109967 And fix the diagnostics for __builtin_is_constant_evaluated(). We can be in a non-constant context, but calling an immediate function always makes the context constant for the duration of that call. >From 7d5

[clang] [clang][docs] Add documentation for APValue constructors (PR #109994)

2024-10-01 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/109994 >From 012465670c63c3283a42a275cf3e5be0c5ffe9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 25 Sep 2024 16:42:55 +0200 Subject: [PATCH] [clang][docs] Add documentation for APValue con

[clang] [clang][docs] Add documentation for APValue constructors (PR #109994)

2024-10-01 Thread Timm Baeder via cfe-commits
@@ -314,51 +314,91 @@ class APValue { DataType Data; public: + /// Creates an empty APValue of type None. APValue() : Kind(None) {} + /// Creates an integer APValue holding the given value. explicit APValue(APSInt I) : Kind(None) { MakeInt(); setInt(std::move(I)

[clang] [clang][bytecode] Protect ia32_{lzcnt,tzcnt} against non-integers (PR #110699)

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

[clang] [clang] Fix C23 constexpr crashes (PR #112708)

2024-10-17 Thread Timm Baeder via cfe-commits
tbaederr wrote: Agreed, LGTM. The first comment in `VarDecl::hasConstantInitialization()` could use some love, since it's no longer true for global constexpr variables. https://github.com/llvm/llvm-project/pull/112708 ___ cfe-commits mailing list cfe-

[clang] [clang][bytecode] Handle non-arrays in initElem{, Pop} (PR #112719)

2024-10-17 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/112719 ... provided the given index is 0. Skip the atIndex() in that case. >From cc844864398bceb91a31c22cd52d16e6dbd9eb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 17 Oct 2024 15:05:29 +

[clang] [clang] Fix C23 constexpr crashes (PR #112708)

2024-10-17 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/112708 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Handle non-arrays in initElem{, Pop} (PR #112719)

2024-10-17 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/112719 ___ 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-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][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-25 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/116843 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Format bitfield width diagnostics with thousands-separators (PR #117763)

2024-11-29 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Is the lifetime for the APSInt here OK? When I call `Diag()`, will the be diagnostic emitted immediately? Or does the APSInt need to life longer? https://github.com/llvm/llvm-project/pull/117763 _

[clang] [clang] Add source range to 'use of undeclared identifier' diagnostics (PR #117671)

2024-11-29 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/117671 >From 1d77f36a1f7fa974d50ff7a5a98b93bbb01ba26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Nov 2024 08:44:57 +0100 Subject: [PAT

[clang] [clang] Add source range to 'use of undeclared identifier' diagnostics (PR #117671)

2024-11-29 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: This is the best version I could come up with. Other than that, the code as it is seems to do what is advertised, i.e. the new output is the desired output. https://github.com/llvm/llvm-project/pull/117671 __

[clang] [clang] Format bitfield width diagnostics with thousands-separators (PR #117763)

2024-11-28 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/117763 >From 07b326b59bf9a8e385840a590c5162b9d1914650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Nov 2024 19:26:32 +0100 Subject: [PAT

[clang] [clang][bytecode] Check FromPtr in BitCastPtr (PR #117142)

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

[clang] [clang][bytecode] Check FromPtr in BitCastPtr (PR #117142)

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

[clang] [clang][bytecode] Initialize bases when bitcasting (PR #117179)

2024-11-21 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/117179 >From 30d56c5522516e1d4b3fdb69c8aae67db8df5d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:3

[clang] [clang][bytecode][NFC] Avoid a getSource() call (PR #117311)

2024-11-22 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/117311 This is only needed when we actually emit a diagnostic, so move the getSource() after the early return. >From bf0c37684268d7afa41beb6035aa137d633ea596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der

[clang] [clang][bytecode] Support ImplicitValueInitExpr for multi-dim arrays (PR #117312)

2024-11-22 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/117312 The attached test case from https://github.com/llvm/llvm-project/issues/117294 used to cause an assertion because we called classifPrim() on an array type. The new result doesn't crash but isn't exactly perfec

[clang] [clang][bytecode] Fix bitcasting from null pointers (PR #116999)

2024-11-22 Thread Timm Baeder via cfe-commits
tbaederr wrote: This needs to incorporate the resolution from https://github.com/llvm/llvm-project/issues/117166, but that doesn't work properly without https://github.com/llvm/llvm-project/pull/116843 mergged first. https://github.com/llvm/llvm-project/pull/116999

[clang] [clang] Format bitfield width diagnostics with thousands-separators (PR #117763)

2024-11-28 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/117763 >From 07b326b59bf9a8e385840a590c5162b9d1914650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Nov 2024 19:26:32 +0100 Subject: [PAT

[clang] [clang] Format bitfield width diagnostics with thousands-separators (PR #117763)

2024-11-28 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/117763 >From 07b326b59bf9a8e385840a590c5162b9d1914650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Nov 2024 19:26:32 +0100 Subject: [PAT

[clang] [clang] Format bitfield width diagnostics with thousands-separators (PR #117763)

2024-11-28 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: tbaederr wrote: Added a `%format` format specifier although the name isn't too good. https://github.com/llvm/llvm-project/pull/117763 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang-tools-extra] [clang] Avoid re-evaluating field bitwidth (PR #117732)

2024-11-27 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Most recent result: http://llvm-compile-time-tracker.com/compare.php?from=6f16a8bf17ac9a171b5435ee53c3d2bef657bdad&to=65e10089b0ca8e2103e6fcf6b082d2bebd3ef458&stat=instructions%3Au > The idea is that you'd store an `Expr` like

[clang] [clang-tools-extra] [clang] Avoid re-evaluating field bitwidth (PR #117732)

2024-11-27 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/117732 >From ca2184f07dbceda33ca429b3d63015d49fef3684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Nov 2024 08:54:51 +0100 Subject: [PAT

[clang] [clang-tools-extra] [clang] Avoid re-evaluating field bitwidth (PR #117732)

2024-11-27 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/117732 >From ca2184f07dbceda33ca429b3d63015d49fef3684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Nov 2024 08:54:51 +0100 Subject: [PAT

[clang] [clang-tools-extra] [clang] Avoid re-evaluating field bitwidth (PR #117732)

2024-11-27 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Meh, saving a `ConstantExpr` in the `FieldDecl` doesn't work properly, since we need to support having arbitrary exprs in case the bitwidth is dependent. https://github.com/llvm/llvm-project/pull/117732 _

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/116843 Let's see what the CI has to say about this. >From a1b1c2a040df2a4510806571a01eae4c546e9caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [c

[clang] [clang][bytecode] Fix ToType/FromType diagnostic ordering (PR #116988)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/116988 We need to check the ToType first, then the FromType. Additionally, remove qualifiers from the parent type of the field we're emitting a note for. >From 328b8fc8faf08cf68036f3bdc67bcfeeb5cfd8c5 Mon Sep 17 00:0

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -362,22 +279,28 @@ bool clang::interp::DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr, assert(Ptr.isBlockPointer()); assert(Buff); - BitcastBuffer Buffer; + size_t BitSize = BuffSize * 8; + BitcastBuffer Buffer(BitSize); if (!CheckBitcastType(S, OpPC,

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From c492b87f0b4b623169f82a0f2705320a3c2ae684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From d00118817a8f3309c4010c523185fb586b16f90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang] Warn on mismatched RequiresCapability attributes (PR #67520)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From c6f184ebf29e74e80590bbd870d0a6a766228421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:39:20 +0200 Subject: [PATCH] Warn on RequiresCapability attribute mismatch -

[clang] [clang] Warn on mismatched RequiresCapability attributes (PR #67520)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -2073,6 +2073,18 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { Warnings.emplace_back(std::move(Warning), getNotes()); } + void handleAttributeMismatch(const NamedDecl *ThisDecl, + const NamedDecl *Pre

[clang] [clang][ExprConst] Explicitly reject dependent types without diagnostic (PR #108598)

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

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From e0304bffdaba9cd0ce14c310882814d7045a0357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From 95c8d0346a83d7137209dde6fb5b61436d210ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From aac1f474855cf6ba29f8d7cba575f8710f9d1482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
tbaederr wrote: CI looks good and I've tested this on both LE and BE systems. Adding some reviewers to double-check. https://github.com/llvm/llvm-project/pull/116843 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang] Warn on mismatched RequiresCapability attributes (PR #67520)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 8fe0b75811632921abc1e4c867d1a2c249a9f7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:39:20 +0200 Subject: [PATCH] Warn on RequiresCapability attribute mismatch -

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From 5dde320def8b11017515ea5121a1cdbd6e2ac6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From bc8a11a461210bad8348af28bdd6f6d3aeae2dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/116843 >From caf66b089176d1952fa8935db3532eb3ef112b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 8 Nov 2024 14:37:56 +0100 Subject: [PATCH] [clang][bytecode] Handle bitcasts involving bitf

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,88 @@ +//=== Bitcastbuffer.cpp -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -295,62 +218,56 @@ static bool CheckBitcastType(InterpState &S, CodePtr OpPC, QualType T, static bool readPointerToBuffer(const Context &Ctx, const Pointer &FromPtr, BitcastBuffer &Buffer, bool ReturnOnUninit) { const ASTContext &ASTCtx = C

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,437 @@ +// RUN: %clang_cc1 -verify=expected,both -std=c++2a -fsyntax-only -fexperimental-new-constant-interpreter %s +// RUN: %clang_cc1 -verify=expected,both -std=c++2a -fsyntax-only -triple aarch64_be-linux-gnu -fexperimental-new-constant-interpreter %s +// RUN: %cl

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-11-20 Thread Timm Baeder via cfe-commits
@@ -362,22 +279,28 @@ bool clang::interp::DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr, assert(Ptr.isBlockPointer()); assert(Buff); - BitcastBuffer Buffer; + size_t BitSize = BuffSize * 8; + BitcastBuffer Buffer(BitSize); if (!CheckBitcastType(S, OpPC,

<    13   14   15   16   17   18   19   20   21   22   >