This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e41e6a4eafa: [clang][Interp] Implement function calls
(authored by tbaeder).
Changed prior to commit:
https://reviews.llvm.org/D132286?vs=455791&id=458645#toc
Repository:
rG LLVM Github Monorepo
CH
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM aside from some small nits you can fix when landing.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:607-610
+ if (auto R =
+ ByteCo
tbaeder updated this revision to Diff 455791.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132286/new/
https://reviews.llvm.org/D132286
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/EvalEmitter.cpp
clang/lib/AST/Inter
aaron.ballman added a comment.
It looks like precommit CI found some relevant failures.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:614
+
+if (Optional T = classify(E->getType())) {
+ // Put arguments on the stack.
tbaeder wrote:
> aaron.ballm
tbaeder updated this revision to Diff 454726.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132286/new/
https://reviews.llvm.org/D132286
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/EvalEmitter.cpp
clang/lib/AST/Inter
tbaeder updated this revision to Diff 454723.
tbaeder marked 3 inline comments as done.
tbaeder added a comment.
I noticed two problems:
1. Calls returning void didn't work. That needed another new opcode
2. When creating a new stackframe and running `Intepret()`... there's nothing
actually stop
tbaeder marked 4 inline comments as done.
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:614
+
+if (Optional T = classify(E->getType())) {
+ // Put arguments on the stack.
aaron.ballman wrote:
> Should this be using `
aaron.ballman added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:603
+ if (const auto *FuncDecl = dyn_cast_or_null(Callee)) {
+Function *Func = P.getFunction(FuncDecl);
+
Comment at: clang/lib/AST/Interp/ByteCodeE
tbaeder updated this revision to Diff 454389.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132286/new/
https://reviews.llvm.org/D132286
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/EvalEmitter.cpp
clang/lib/AST/Inter
tbaeder added inline comments.
Comment at: clang/test/AST/Interp/functions.cpp:38
+static_assert(add_second(10, 3, true) == 13, "");
+static_assert(add_second(300, -20, false) == 300, "");
shafik wrote:
> I would expect a lot more test cases: trailing return type
tbaeder updated this revision to Diff 454386.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132286/new/
https://reviews.llvm.org/D132286
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/Context.h
clang/lib/AST/Interp/Eval
shafik added inline comments.
Comment at: clang/test/AST/Interp/functions.cpp:38
+static_assert(add_second(10, 3, true) == 13, "");
+static_assert(add_second(300, -20, false) == 300, "");
I would expect a lot more test cases: trailing return types, default argume
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/Interp.cpp:60
+ S.Current =
+ new InterpFrame(S, const_cast(Func), S.Current, PC, {});
+
This patch adds two `const_cast`s. They aren't strictly necessary, since the
`InterpFrame` doesn't need
tbaeder created this revision.
tbaeder added reviewers: erichkeane, aaron.ballman, shafik, tahonermann.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Add a `Call` op and use the existing infrastructure
14 matches
Mail list logo