19 Commits

Author SHA1 Message Date
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
Timm Baeder
f70ccdaeb4
[clang][bytecode][NFC] Move Call ops into Interp.cpp (#107104)
They are quite long and not templated.
2024-09-03 16:15:58 +02:00
Timm Baeder
0f5f440f24
[clang][bytecode] Pass FPOptions to floating point ops (#107063)
So we don't have to retrieve them from the InterpFrame, which is slow.
2024-09-03 14:24:11 +02:00
Timm Baeder
6f81c878ec
[clang][bytecode][NFC] Implement MemberPointer::toDiagnosticString() (#106825) 2024-08-31 07:26:02 +02:00
Timm Baeder
360e4abfc8
[clang][bytecode] Diagnose comparisons with literals (#106734)
This requires adding a new opcode for PointerToBoolean casts, since we
otherwise emit too many diagnostics. But that fixes an older problem
when casting weak pointers to bool.
2024-08-31 06:24:36 +02:00
Timm Baeder
df11ee213e
[clang][bytecode] Diagnose member calls on deleted blocks (#106529)
This requires a bit of restructuring of ctor calls when checking for a
potential constant expression.
2024-08-29 15:22:59 +02:00
Timm Baeder
40db261551
[clang][bytecode] Fix #55390 here as well (#106395)
Ignore the multiplication overflow but report the 0 denominator.
2024-08-28 19:09:12 +02:00
Timm Baeder
f7a74ece5a
[clang][bytecode] Diagnose array-to-pointer decays of dummy pointers (#106366)
We have type information for them now, so we can do this.
2024-08-28 13:41:01 +02:00
yronglin
d9e7286019
[NFC][clang][bytecode] Rename clang::interp::State::getCtx to clang::interp::State::getASTContext (#106071)
The new constant interpreter's `clang::interp::InterpState` contains
both `clang::interp::Context` and `clang::ASTContext`. So using `S.Ctx`
and `S.getCtx()` was a bit confusing. This PR rename `getCtx()` to
`getASTContext` to make things more clearer.

Signed-off-by: yronglin <yronglin777@gmail.com>
2024-08-26 22:23:07 +08:00
Timm Baeder
99b85cae62
[clang][bytecode][NFC] Add an additional assertion (#105927)
Since this must be true, add an assertion instead of just documenting it
via the comment.
2024-08-24 09:23:25 +02:00
Timm Baeder
b9c4c4ccf9
[clang][bytecode] Fix 'if consteval' in non-constant contexts (#104707)
The previous code made this a compile-time decision but it's not.
2024-08-22 19:06:09 +02:00
Timm Baeder
db94852b9b
[clang][bytecode] Allow adding offsets to function pointers (#105641)
Convert them to Pointers, do the offset calculation and then convert
them back to function pointers.
2024-08-22 15:23:50 +02:00
Timm Baeder
a14c730990
[clang][bytecode] Fix diagnostic in final ltor cast (#105292)
Don't diagnose volatile reads but diagnose a few other accesses earlier.
2024-08-21 08:08:32 +02:00
Timm Baeder
ba7dadf0e9
[clang][bytecode] Fix initializing base casts (#104901)
Use delegate() there. To fix a follow-up problem, abort when a cast ends
up on a valid Pointer that isn't a base class.
2024-08-20 11:44:30 +02:00
Timm Baeder
ca148b2150
[clang][bytecode] Support ObjC blocks (#104551)
I started out by adding a new pointer type for blocks, and I was fully
prepared to compile their AST to bytecode and later call them.

... then I found out that the current interpreter doesn't support
calling blocks at all. So we reuse `Function` to support sources other
than `FunctionDecl`s and classify `BlockPointerType` as `PT_FnPtr`.
2024-08-20 06:08:53 +02:00
Timm Bäder
d082f1f37d [clang][bytecode] Only booleans can be inverted
No need to have the Inv() function be templated.
2024-08-18 16:02:32 +02:00
Timm Baeder
dac182990d
[clang][bytecode] IntPointer::atOffset() should append (#104686)
... to current offset. This breaks other tests which this commit also
fixes. Namely, getIndex() should return the integer representation for
non-block pointers.
2024-08-18 08:59:34 +02:00
Timm Baeder
555399d562
[clang][bytecode] Fix shifting negative values (#104663) 2024-08-17 22:57:19 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00