Skip to content

Commit 17963fa

Browse files
committed
[clang][bytecode] Save Immediate bit in Function
Otherwise, we have to look at the FunctionDecl at every function call.
1 parent 3cfdf2c commit 17963fa

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

clang/lib/AST/ByteCode/Function.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize,
2626
HasRVO(HasRVO) {
2727
if (const auto *F = dyn_cast<const FunctionDecl *>(Source)) {
2828
Variadic = F->isVariadic();
29+
Immediate = F->isImmediateFunction();
2930
if (const auto *CD = dyn_cast<CXXConstructorDecl>(F)) {
3031
Virtual = CD->isVirtual();
3132
Kind = FunctionKind::Ctor;

clang/lib/AST/ByteCode/Function.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class Function final {
155155

156156
/// Checks if the function is virtual.
157157
bool isVirtual() const { return Virtual; };
158+
bool isImmediate() const { return Immediate; }
158159

159160
/// Checks if the function is a constructor.
160161
bool isConstructor() const { return Kind == FunctionKind::Ctor; }
@@ -292,6 +293,7 @@ class Function final {
292293
bool Defined = false;
293294
bool Variadic = false;
294295
bool Virtual = false;
296+
bool Immediate = false;
295297

296298
public:
297299
/// Dumps the disassembled bytecode to \c llvm::errs().

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ bool Call(InterpState &S, CodePtr OpPC, const Function *Func,
15021502
InterpFrame *FrameBefore = S.Current;
15031503
S.Current = NewFrame.get();
15041504

1505-
InterpStateCCOverride CCOverride(S, Func->getDecl()->isImmediateFunction());
1505+
InterpStateCCOverride CCOverride(S, Func->isImmediate());
15061506
// Note that we cannot assert(CallResult.hasValue()) here since
15071507
// Ret() above only sets the APValue if the curent frame doesn't
15081508
// have a caller set.

0 commit comments

Comments
 (0)