[clang] 8ff81de - [clang][Interp][NFC] Remove some redundant code
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 11 21:38:17 PST 2023
Author: Timm Bäder
Date: 2023-11-12T06:37:51+01:00
New Revision: 8ff81deeaa71ec5792c480c9b962f7c48753e0a6
URL: https://github.com/llvm/llvm-project/commit/8ff81deeaa71ec5792c480c9b962f7c48753e0a6
DIFF: https://github.com/llvm/llvm-project/commit/8ff81deeaa71ec5792c480c9b962f7c48753e0a6.diff
LOG: [clang][Interp][NFC] Remove some redundant code
The needsRuntimeArgPop() stuff is now handled by the
cleanupAfterFunctionCall() function.
Added:
Modified:
clang/lib/AST/Interp/Function.cpp
clang/lib/AST/Interp/Function.h
clang/lib/AST/Interp/Interp.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Function.cpp b/clang/lib/AST/Interp/Function.cpp
index 357aff7fe6229b9..69ab1e57b633018 100644
--- a/clang/lib/AST/Interp/Function.cpp
+++ b/clang/lib/AST/Interp/Function.cpp
@@ -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());
-}
diff --git a/clang/lib/AST/Interp/Function.h b/clang/lib/AST/Interp/Function.h
index be9b1733635f725..94eb2a611771b0c 100644
--- a/clang/lib/AST/Interp/Function.h
+++ b/clang/lib/AST/Interp/Function.h
@@ -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 {
diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index 144b674451e353c..5fe9cf80fc94709 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -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.
More information about the cfe-commits
mailing list