13 Commits

Author SHA1 Message Date
Timm Baeder
16c721f2d1
[clang][bytecode] Destroy local variables in reverse order (#125727)
See the attached test case.
2025-02-05 08:09:13 +01:00
Timm Baeder
06130ed341
Reapply "[clang][bytecode] Stack-allocate bottom function frame" (#12… (#125349)
…5325)

Move the BottomFrame to InterpState instead.
2025-02-01 18:12:35 +01:00
Jorge Gorbe Moya
386af4a5c6
Revert "[clang][bytecode] Stack-allocate bottom function frame" (#125325)
Reverts llvm/llvm-project#125253

It introduced an msan failure. Caught by a buildbot here:
https://lab.llvm.org/buildbot/#/builders/164/builds/6922/steps/17/logs/stdio
2025-01-31 20:09:14 -08:00
Timm Baeder
f3549814f8
[clang][bytecode] Stack-allocate bottom function frame (#125253)
Instead of heap-allocating it. This is similar to what the current
interpeter does. In C, we have no function calls, so the extra heap
allocation never makes sense.
2025-01-31 20:08:58 +01:00
Timm Baeder
3c8dfce3de
[clang][bytecode][NFC] Use RetPC in InterpFrame::getExpr() as well (#125200)
Both getLocation() and getRange() use the RetPC if the current function
doesn't have a usable body. Using PC here was just a typo.
2025-01-31 12:54:42 +01:00
Timm Baeder
ceaf6e912a
[clang][bytecode] Support ImplicitValueInitExpr for multi-dim arrays (#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 perfect either. Since the
problem arises when evaluating an ImplicitValueInitExpr, we have no
proper source location to point to. Point to the caller instead.
2024-11-25 12:15:31 +01: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
898fd396b8
[clang][bytecode] Check allocation size limit for operator new (#109590) 2024-09-23 09:59: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 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
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
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
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