Timm Baeder
c2a37e41b9
[clang][bytecode] Implement fixed point casts ( #110409 )
2024-09-29 08:58:21 +02:00
Timm Baeder
defead4d2d
[clang][bytecode] Implement fixed-point add ( #110405 )
2024-09-29 07:13:17 +02:00
Timm Baeder
3a5b9da115
[clang][bytecode] Implement fixed-point-to-float casts ( #110369 )
2024-09-28 19:11:49 +02:00
Timm Baeder
6cbd8a3094
[clang][bytecode] Implement floating-to-fixed-point casts ( #110361 )
2024-09-28 17:24:28 +02:00
Timm Baeder
6b62e04e30
[clang][bytecode] Implement (N)EQ between fixed point and integral ( #110358 )
...
Convert the non-fixed-point side to a fixed-point type before doing the
comparison.
2024-09-28 15:38:33 +02:00
Timm Baeder
641b4d5370
[clang][bytecode] Implement integral-to-fixed-point casts ( #110350 )
2024-09-28 13:10:23 +02:00
Timm Baeder
6fd870bf35
[clang][bytecode] Implement zero-init for fixed point types ( #110257 )
2024-09-27 18:29:34 +02:00
Timm Baeder
d9b377d8b1
[clang][bytecode] Don't produce a null type when checking new exprs ( #110252 )
...
getType() might give us the right type already, so use that instead of
calling getPointeeType() for all CXXNewExprs.
2024-09-27 17:48:43 +02:00
Timm Baeder
581c015ed0
[clang][bytecode] Implement fixed point negation ( #110237 )
2024-09-27 13:29:14 +02:00
Timm Baeder
048bc67276
[clang][bytecode] Start implementing fixed point types ( #110216 )
...
Add the primitive type and implement to-bool casts.
2024-09-27 11:32:43 +02:00
Timm Baeder
09cd5a8673
[clang][bytecode] Refuse to contruct objects with virtual bases ( #110142 )
2024-09-27 05:56:12 +02:00
Richard Smith
d8a2815903
[clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation ( #109208 )
...
Track the identity of each string literal object produced by evaluation
with a global version number. Accept comparisons between literals of the
same version, and between literals of different versions that cannot
possibly be placed in overlapping storage. Treat the remaining
comparisons as non-constant.
---------
Co-authored-by: Timm Baeder <tbaeder@redhat.com >
Co-authored-by: Aaron Ballman <aaron@aaronballman.com >
2024-09-26 15:56:33 -07:00
Timm Baeder
3ea55d3cb0
[clang][bytecode] Add a source location to destructor calls ( #110121 )
...
The added test case is still diagnosed differently, but I'm not sure
which version is better.
2024-09-26 16:50:56 +02:00
Timm Baeder
82ce8296b8
[clang][bytecode] Don't call dtors of anonymous unions ( #110087 )
2024-09-26 12:50:53 +02:00
Timm Baeder
4bd3a62cd6
[clang][bytecode] Fix diagnosing std::construct_at with wrong type ( #109828 )
...
We can't make the assumption that types are always fine in std
functions.
2024-09-25 08:00:32 +02:00
Timm Baeder
4b96400240
[clang][bytecode] Allow placement-new in std functions pre-C++26 ( #109753 )
2024-09-24 10:28:54 +02:00
Timm Baeder
e4d34261f8
[clang][bytecode] Ignore CPointerToObjCPointerCasts ( #109760 )
2024-09-24 10:18:33 +02:00
Timm Baeder
c712ab829b
[clang][bytecode] Implement placement-new ( #107033 )
...
If we have a placement-new destination already, use that instead of
allocating a new one.
Tests are partially based on
`test/SemaCXX/cxx2c-constexpr-placement-new.cpp`.
2024-09-23 13:26:49 +02:00
Timm Bäder
bad544461a
[clang][bytecode][NFC] Remove an outdated comment
2024-09-23 11:54:00 +02:00
Timm Baeder
898fd396b8
[clang][bytecode] Check allocation size limit for operator new ( #109590 )
2024-09-23 09:59:41 +02:00
Timm Baeder
f86050de73
[clang][bytecode] Don't call checkLiteralType() in visitInitializer() ( #109530 )
...
We were calling checkLiteralType() too many time and rejecting some
things we shouldn't. Add The calls manually when handling
MaterializeTemporaryExprs. Maybe we should call it in other places as
well, but adding more calls is easier than removing them from a generic
code path.
2024-09-21 20:01:21 +02:00
yronglin
f5a65d8752
[clang][bytecode] Implement arithmetic, bitwise and compound assignment operator ( #108949 )
...
Implement `+`, `-`, `*`, `/` , `%`, `&`, `|`, `^`, `<<`, `>>` and
compound assignment operator.
---------
Signed-off-by: yronglin <yronglin777@gmail.com >
2024-09-21 17:05:24 +08:00
Timm Baeder
5b4c80f123
[clang][bytecode] Create dummy pointers for ObjCStringLiterals ( #109520 )
...
We need to have the final APValue point to the ObjCStringLiteral
expression, not the StringLiteral itself.
2024-09-21 10:33:02 +02:00
Timm Baeder
9a32f28366
[clang][bytecode] Fix a problem with array size limits ( #109383 )
...
Descriptor::MaxArrayElemBytes is an unsigned value, which might overflow
the SizeT we have in CheckArraySize.
2024-09-20 11:26:58 +02:00
Timm Baeder
d267daa9eb
[clang][bytecode] Diagnose loads from weak variables ( #109256 )
2024-09-19 11:59:38 +02:00
Timm Baeder
904f58e6b9
[clang][bytecode] Use field descriptor in IntPointer::atOffset ( #109238 )
...
We're otherwise still pointing to the old type, but with the new offset.
2024-09-19 09:12:17 +02:00
Timm Baeder
0050503b7a
[clang][bytecode] Allow right-shift of negative values ( #108987 )
...
We used to incorrectly diagnose this as a "left shift of negative
value".
2024-09-17 18:25:16 +02:00
Timm Baeder
8e2dbab242
[clang][bytecode] Fix defining extern variables ( #108940 )
...
At the point of defintion of the variable, a function might already
refert to the variable by its index. Replace the index with the new one.
2024-09-17 15:21:28 +02:00
Timm Bäder
95a0b4f729
Revert "[clang][ExprConst] Allow comparisons with string literals ( #106733 )"
...
This reverts commit 5d1d2f08c4 .
See the discussion in https://github.com/llvm/llvm-project/pull/106733
and https://github.com/llvm/llvm-project/issues/58754
2024-09-17 05:58:54 +02:00
Timm Baeder
0bc8168070
[clang][bytecode] Fix reinterpret_casts from pointer to non-pointers ( #108811 )
...
We need to be a little more careful here with whether or nor we are able
to do the cast at all or not.
2024-09-16 17:35:38 +02:00
Timm Baeder
fbf0a80153
[clang][bytecode] Implement HLSLVectorTruncation casts ( #108499 )
2024-09-13 11:32:12 +02:00
Timm Baeder
5d1d2f08c4
[clang][ExprConst] Allow comparisons with string literals ( #106733 )
...
Don't diagnose them, but literals still have distinct addresses.
Fixes https://github.com/llvm/llvm-project/issues/58754
2024-09-13 10:30:02 +02:00
Timm Baeder
43fd2c401e
[clang][bytecode] Implement base casts on integral pointers ( #108340 )
...
Get the right offset to apply from the RecordLayout.
2024-09-12 17:19:37 +02:00
Timm Baeder
f22a8d1822
[clang][bytecode] Fix modify_global diagnostics in C++11 ( #108358 )
...
We shouldn't emit this until C++14.
2024-09-12 13:25:25 +02:00
Timm Baeder
35f7cfb224
[clang][bytecode] Check for Pointer dereference in EvaluationResult ( #108207 )
...
We will deref<>() it later, so this is the right check.
2024-09-11 16:14:41 +02:00
Timm Baeder
d03822d888
[clang][bytecode] Fix lookup of source locations in implicit ctors ( #107992 )
...
Implicit functions may still have a body. The !hasBody() check is
enough.
2024-09-11 07:21:49 +02:00
Timm Bäder
6a56f15211
[clang][bytecode][NFC] Fix a commented-out test
2024-09-10 14:05:46 +02:00
Timm Baeder
3928edecfb
[clang][bytecode] Fix local destructor order ( #107951 )
...
Add appropriate scopes and use reverse-order iteration in
LocalScope::emitDestructors().
2024-09-10 06:26:46 +02:00
Timm Baeder
6f67c38684
[clang][bytecode] Fix a variable scope problem with continue/break jumps ( #107738 )
...
Cleaning up _all_ the scopes is a little too much. Only clean up until
the point here we started the scope relevant for the break/continue
statement.
2024-09-08 19:22:18 +02:00
yronglin
cf11eb62e1
[clang][bytecode] Implement logical operators for vector type ( #107678 )
...
Implement `&&`, `||` logical operators for vector type.
---------
Signed-off-by: yronglin <yronglin777@gmail.com >
2024-09-08 14:04:00 +08:00
Timm Baeder
d6d60707ec
[clang][bytecode] Fix two-pointer-style std::initializer_lists ( #107682 )
...
The first pointer needs to point to the first element of the underlying
array. This requires some changes to how we handle array expansion
2024-09-07 14:27:09 +02:00
Timm Baeder
78cf9b830c
[clang][bytecode] Implement using operator new/operator delete ( #107679 )
...
Reuse the __builtin_operator_{new,delete} implementations.
2024-09-07 12:17:54 +02:00
Timm Baeder
610b85395d
[clang][bytecode] Implement __builtin_operator{new,delete} ( #107672 )
2024-09-07 09:57:26 +02:00
Timm Baeder
83fea8b809
[clang][bytecode] Allow continuing when discarded MemberExpr Base fails ( #107231 )
...
We don't need the value in this case, since we're discarding it anyway.
Allow continuing the interpretation but note the side effect.
2024-09-07 09:33:27 +02:00
yronglin
67f9183c11
[clang][bytecode] Implement comparsion operators for vector type ( #107258 )
...
Implement ==, !=, <, <=, >, >= comparsion operators for vector type.
---------
Signed-off-by: yronglin <yronglin777@gmail.com >
2024-09-06 20:27:11 +08:00
Mital Ashok
84cf3a573e
[Clang] CWG2749: relational operators involving pointers to void ( #93046 )
...
https://cplusplus.github.io/CWG/issues/2749.html
This DR's effects are backported to C++98.
Does not affect C where integral constant expressions cannot involve
pointers.
---------
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav@gmail.com >
Co-authored-by: cor3ntin <corentinjabot@gmail.com >
2024-09-05 14:23:08 +02:00
Timm Baeder
9626e84fae
[clang][bytecode][NFC] Simplify builtin-functions.cpp ( #107118 )
...
The effect is the same, but this version doesn't take as long to
evaluate.
2024-09-03 18:41:01 +02:00
Timm Baeder
733a92d7bc
[clang][bytecode] Print Pointers via APValue ( #107056 )
...
Instead of doing this ourselves, just rely on printing the APValue.
2024-09-03 11:07:19 +02:00
Timm Baeder
f838d6b1b2
[clang][bytecode] Implement __noop ( #106714 )
...
This does nothing and returns 0.
2024-09-02 13:50:22 +02:00
Timm Bäder
f79722b932
[clang][bytecode][NFC] Move test case to -verify=both style
2024-09-02 13:15:48 +02:00