Skip to content

Commit

Permalink
[clang][Interp][NFC] Remove some redundant code
Browse files Browse the repository at this point in the history
The needsRuntimeArgPop() stuff is now handled by the
cleanupAfterFunctionCall() function.
  • Loading branch information
tbaederr committed Nov 12, 2023
1 parent 190b917 commit 8ff81de
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
6 changes: 0 additions & 6 deletions clang/lib/AST/Interp/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,3 @@ bool Function::isVirtual() const {
return M->isVirtual();
return false;
}

bool Function::needsRuntimeArgPop(const ASTContext &Ctx) const {
if (!isBuiltin())
return false;
return Ctx.BuiltinInfo.hasCustomTypechecking(getBuiltinID());
}
4 changes: 0 additions & 4 deletions clang/lib/AST/Interp/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ class Function final {

bool isBuiltin() const { return F->getBuiltinID() != 0; }

/// Does this function need its arguments to be classified at runtime
/// rather than at bytecode-compile-time?
bool needsRuntimeArgPop(const ASTContext &Ctx) const;

unsigned getNumParams() const { return ParamTypes.size(); }

unsigned getParamOffset(unsigned ParamIndex) const {
Expand Down
14 changes: 0 additions & 14 deletions clang/lib/AST/Interp/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,6 @@ void cleanupAfterFunctionCall(InterpState &S, CodePtr OpPC) {
const Function *CurFunc = S.Current->getFunction();
assert(CurFunc);

// Certain builtin functions are declared as func-name(...), so the
// parameters are checked in Sema and only available through the CallExpr.
// The interp::Function we create for them has 0 parameters, so we need to
// remove them from the stack by checking the CallExpr.
// FIXME: This is potentially just a special case and could be handled more
// generally with the code just below?
if (CurFunc->needsRuntimeArgPop(S.getCtx())) {
const auto *CE = cast<CallExpr>(S.Current->getExpr(OpPC));
for (int32_t I = CE->getNumArgs() - 1; I >= 0; --I) {
popArg(S, CE->getArg(I));
}
return;
}

if (S.Current->Caller && CurFunc->isVariadic()) {
// CallExpr we're look for is at the return PC of the current function, i.e.
// in the caller.
Expand Down

0 comments on commit 8ff81de

Please sign in to comment.