Timm Baeder
cc4dd015ad
[clang][bytecode][NFC] Remove VariableScope::emitDestruction ( #169148 )
...
destroyLocals() does the same thing.
2025-11-22 16:41:00 +01:00
marius doerner
7198279707
[clang][bytecode] Implement case ranges ( #168418 )
...
Fixes #165969
Implement GNU case ranges for constexpr bytecode interpreter.
2025-11-20 04:50:32 +01:00
Timm Baeder
886d24d03a
[clang][bytecode] Fix fallthrough to switch labels ( #168484 )
...
We need to fallthrough here in case we're not jumping to the labels.
This is only needed in expression contexts.
2025-11-18 07:46:46 +01:00
Timm Baeder
746e5d0492
[clang][bytecode] Don't outright reject dynamic casts ( #167517 )
...
Just delegate to the subexpr instead for now.
2025-11-14 13:03:51 +01:00
Timm Baeder
70eb4b0a60
[clang][bytecode] Fix diagnosing subtration of zero-size pointers ( #167839 )
...
We need to get the element type size at bytecode generation time to
check. We also need to diagnose this in the LHS == RHS case.
2025-11-13 09:58:43 +01:00
Timm Baeder
8e3188a47f
[clang][bytecode] Mark CXXDefaultInitExprs in InitLink chain ( #166395 )
...
So we know before _what_ entry in the chain we need to look for the
InitList.
Fixes https://github.com/llvm/llvm-project/issues/166171
2025-11-11 10:36:00 +01:00
Timm Baeder
a8a0ffba73
[clang][bytecode] Check source pointer for bitcast validity ( #166907 )
...
Unfortunately this is more dynamic than anticipated.
Fixes https://github.com/llvm/llvm-project/issues/165006
2025-11-10 08:17:08 +01:00
Timm Baeder
6c12623d62
[clang][bytecode] Fix a std::optional<bool> mishap ( #167091 )
...
This is about the value saved in the std::optional, not about whether
the optional has a value at all.
2025-11-08 05:31:30 +00:00
Timm Baeder
6fac21e404
[clang][bytecode] Avoid copies with elidable CXXConstructExprs ( #166931 )
...
To fix the newly added cwg6.cpp.
2025-11-08 05:30:01 +01:00
KaiWeng
d9c7c76269
Revert "Ignore trailing NullStmts in StmtExprs for GCC compatibility." ( #166036 )
...
This reverts commit b1e511bf5a4c702ace445848b30070ac2e021241.
https://github.com/llvm/llvm-project/issues/160243
Reverting because the GCC C front end is incorrect.
---------
Co-authored-by: Jim Lin <jim@andestech.com>
2025-11-07 09:30:53 -05:00
Timm Baeder
e4467fbf30
[clang][ExprConst] Handle dependent switch case statements ( #166533 )
...
By rejecting them.
Fixes https://github.com/llvm/llvm-project/issues/165555
2025-11-06 12:52:11 +01:00
Timm Baeder
14c76437ee
[clang][bytecode] Check types when loading values ( #165385 )
...
We need to allow BitCasts between pointer types to different prim types,
but that means we need to catch the problem at a later stage, i.e. when
loading the values.
Fixes https://github.com/llvm/llvm-project/issues/158527
Fixes https://github.com/llvm/llvm-project/issues/163778
2025-11-05 16:02:19 +01:00
Timm Baeder
9af49ee474
[clang][bytecode] Handle discarded AddrLabelExprs properly ( #165000 )
...
emitDummyPtr() doesn't like to be called with DiscardResult set, so
check this first.
Fixes https://github.com/llvm/llvm-project/issues/164979
2025-10-27 10:28:09 +01:00
Timm Baeder
7c441b21b7
[clang][bytecode] Catch placement-new into invalid destination ( #164804 )
...
We failed to check for null and non-block pointers.
Fixes https://github.com/llvm/llvm-project/issues/152952
2025-10-24 08:08:18 +02:00
Timm Baeder
93bb5c699f
[clang][bytecode] Fix CXXConstructExpr for multidim arrays ( #164760 )
...
This is a thing apparently.
Fixes https://github.com/llvm/llvm-project/issues/153803
2025-10-24 06:36:05 +02:00
Timm Baeder
ece83ed7df
[clang][bytecode] Fix instance pointer in IndirectFieldDecl inits ( #164751 )
...
Points to the first chain link in this case.
2025-10-23 15:22:17 +02:00
Timm Baeder
0591297c8a
[clang][bytecode] Fix initializing primitive fields via initlist ( #164789 )
...
Fixes https://github.com/llvm/llvm-project/issues/152901
2025-10-23 14:19:13 +02:00
Timm Baeder
954a719056
[clang][bytecode] Fix unsigned wraparound behavior with bitfields ( #164445 )
...
and inc/dec operations. We need to truncate the new value to the
bitfield bitwidth.
2025-10-22 11:01:33 +02:00
Timm Baeder
9e7209c061
[clang][bytecode][NFC] Clean up variable creation ( #164415 )
2025-10-21 17:31:05 +02:00
Timm Baeder
7b91bb2046
[clang][bytecode] Fix redeclaring global externs without initializer ( #164409 )
...
Return the same value, whether we've already allocated the variable or
not.
2025-10-21 15:14:26 +02:00
Timm Baeder
c5f9a2a2b2
[clang][bytecode] Don't emit checkNull for function pointers ( #164376 )
...
Diagnose them later when we try to call the function pointer.
2025-10-21 14:49:03 +02:00
Matheus Izvekov
b516dcc998
[clang] NFC: rename TagType::getOriginalDecl back to getDecl ( #163271 )
...
This rename was made as part of
https://github.com/llvm/llvm-project/pull/147835 in order to ease
rebasing the PR, and give a nice window for other patches to get rebased
as well.
It has been a while already, so lets go ahead and rename it back.
2025-10-15 16:11:17 -03:00
Timm Baeder
93c830597c
[clang][bytecode] Fix integral cast edge case ( #161506 )
...
We were converting the `ASInt` to as sign-less `APInt` too early and
losing the sign information.
2025-10-01 13:56:38 +02:00
Timm Baeder
c750487292
[clang][bytecode] Diagnose volatile writes ( #160350 )
2025-09-28 07:21:40 +02:00
Timm Baeder
492b60937b
[clang][bytecode] Remove bogus Initializing special case ( #159933 )
...
This doesn't seem to be needed anymore and causes problems.
Fixes #159787
2025-09-23 12:55:48 +02:00
Timm Baeder
242a1e2fb1
[clang][bytecode] Load value of non-lvalue ArraySubscriptExpr ( #160024 )
...
As happens in C.
Fixes #158482
2025-09-23 09:47:23 +02:00
Timm Baeder
03e16c8e42
[clang][bytecode] Move generic lambda handling to Compiler ( #159733 )
...
So the static invoker's Function still points to the static invoker
instead of the call operator of the lambda record. This is important for
a later commit.
2025-09-19 12:51:02 +02:00
Timm Baeder
29c55d0f7b
[clang][bytecode] Improve error detection in BitCastPrim op ( #158575 )
...
Reject bitcasts to pointer types unless it's to `nullptr_t` and always
reject bitcasts to member pointer types.
Fixes #156174
2025-09-16 10:02:18 +02:00
Timm Baeder
c8b5b6e0a6
[clang][ExprConst] Reject unary vector shuffles ( #158589 )
...
This is not implemented at compile time and asserts in assertion builds,
so reject it here.
Fixed the coding style in `BuiltinShuffleVector` at the same time.
Fixes #158471
2025-09-16 07:58:15 +02:00
Timm Baeder
c46cf1ea3b
[clang][bytecode][NFC] Remove BlockScope ( #158656 )
...
Unused these days.
2025-09-16 05:10:13 +02:00
Timm Baeder
03c356c554
[clang][bytecode] Pass initializer along in evaluateAsInitializer() ( #158056 )
...
We just called `getInit()`, which isn't always correct and used the
wrong initializer in the module test case.
2025-09-15 07:39:11 +02:00
Timm Baeder
859e8a6d6b
[clang][bytecode] Implement C23 named loops ( #156856 )
2025-09-11 09:19:17 +02:00
Timm Baeder
e2a067e7e5
[clang][bytecode][NFC] Remove an else after a return ( #157999 )
2025-09-11 09:02:46 +02:00
Timm Baeder
8ba0d0f72f
[clang][bytcode][NFC] Use UnsignedOrNone for global ids ( #157328 )
2025-09-08 08:56:46 +02:00
Timm Baeder
e9499e82ed
[clang][bytecode][NFC] Remove some unnecessary if statements ( #157329 )
...
We already checked that `IsStatic` is true above.
2025-09-07 18:55:48 +02:00
Timm Baeder
46f2b35a98
[clang][bytecode][NFC] Remove instance pointer from emitDestruction ( #157040 )
...
We only call this when we just pushed a new pointer to the stack, so try
to save the folling PopPtr op by removing the pointer inside
emitDestruction directly, e.g. by letting the Call op just remove it.
2025-09-05 10:29:43 +02:00
Timm Baeder
9e755445f1
[clang][bytecode] Create implicit variables for wider base types ( #156658 )
...
If we create an implicit local variable for a derived-to-base cast, we
still should allocate enough space for the entire derived type.
Fixes #156219
2025-09-04 15:38:14 +02:00
Timm Baeder
917b45539b
[clang][bytecode] Remove superfluous check for complex types ( #156666 )
...
`!E->getType()->isAnyComplexType()` is implied by `!canClassify()`.
2025-09-04 07:40:48 +02:00
Timm Baeder
1bbac057f6
[clang][bytecode] Fix ignoring comparisons in C ( #156180 )
...
Our comparison ops always return bool, and we do the pop before the
conversion to in in C.
Fixes #156178
2025-08-30 17:41:08 +02:00
Timm Baeder
1eb6c2bd59
[clang][bytecode] Reject vectors with non-primitive element types ( #155597 )
...
This happens for e.g. arm's float8 types.
2025-08-27 14:09:54 +02:00
Timm Baeder
16494be2e8
[clang][bytecode] Reject dependent RequiresExprs ( #155230 )
...
Fixes #152899
2025-08-27 12:04:44 +02:00
Timm Baeder
d5c5ed3723
[clang][bytecode] Handle vector assignments ( #155573 )
2025-08-27 11:55:37 +02:00
Matheus Izvekov
88438ba1f3
[clang] AST: fix getAs canonicalization of leaf types ( #155028 )
2025-08-27 06:20:14 -03:00
Matheus Izvekov
2ec71d93ad
[clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all TagDecls ( #155463 )
...
And make use of those.
These changes are split from prior PR #155028 , in order to decrease the
size of that PR and facilitate review.
2025-08-26 16:05:59 -03:00
Timm Baeder
1739a0e5fb
[clang][bytecode] Error if calls have fewer arguments than parameters ( #155151 )
...
Shouldn't happen, but does.
Fixes #155147
2025-08-26 06:17:39 +02:00
Vincent
fefdb494bf
[Clang] Fix Variable Length Array _Countof Crash ( #154627 )
...
Check for missing VLA size expressions (e.g. in int a[*][10]) before
evaluation to avoid crashes in _Countof and constant expression checks.
Fixes #152826
2025-08-25 21:06:49 +02:00
Timm Baeder
c540678920
[clang][bytecode] Fix OptionScope initializer ( #155149 )
...
Initialize the `OldToLValue` member with the actual old value of
`ToLValue`.
Pointed out by Shafik in
https://github.com/llvm/llvm-project/pull/153601#discussion_r2294319428
2025-08-25 12:55:34 +02:00
Timm Baeder
ab8b4f6629
[clang][bytecode][NFC] Replace std::optional<unsigned> with UnsignedO… ( #154286 )
...
…rNone
2025-08-19 11:37:32 +02:00
Timm Baeder
a1039c1b84
[clang][bytecode] Fix initializing float elements from #embed ( #154285 )
...
Fixes #152885
2025-08-19 11:04:21 +02:00
Timm Baeder
da05208bfb
[clang][bytecode] Create temporary before discarding CXXConstructExpr ( #154280 )
...
Fixes #154110
2025-08-19 10:27:26 +02:00