Skip to content

Commit

Permalink
Change several functions in external_c_functions from static function…
Browse files Browse the repository at this point in the history
…s into anonymous namespace.
  • Loading branch information
niyue committed Nov 13, 2023
1 parent 0d10f86 commit a3d0625
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cpp/src/gandiva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ set(SRC_FILES
exported_funcs.cc
external_c_functions.cc
filter.cc
function_ir_builder.cc
function_holder_maker_registry.cc
function_ir_builder.cc
function_registry.cc
function_registry_arithmetic.cc
function_registry_datetime.cc
Expand Down
16 changes: 10 additions & 6 deletions cpp/src/gandiva/external_c_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
#include "gandiva/engine.h"
#include "gandiva/exported_funcs.h"

namespace gandiva {
namespace {
// calculate the number of arguments for a function signature
static size_t GetNumArgs(const FunctionSignature& sig, const NativeFunction& func) {
size_t GetNumArgs(const gandiva::FunctionSignature& sig,
const gandiva::NativeFunction& func) {
auto num_args = 0;
num_args += func.NeedsContext() ? 1 : 0;
num_args += func.NeedsFunctionHolder() ? 1 : 0;
Expand All @@ -34,8 +35,9 @@ static size_t GetNumArgs(const FunctionSignature& sig, const NativeFunction& fun
}

// map from a NativeFunction's signature to the corresponding LLVM signature
static Result<std::pair<std::vector<llvm::Type*>, llvm::Type*>> MapToLLVMSignature(
const FunctionSignature& sig, const NativeFunction& func, LLVMTypes* types) {
arrow::Result<std::pair<std::vector<llvm::Type*>, llvm::Type*>> MapToLLVMSignature(
const gandiva::FunctionSignature& sig, const gandiva::NativeFunction& func,
gandiva::LLVMTypes* types) {
std::vector<llvm::Type*> arg_llvm_types;
arg_llvm_types.reserve(GetNumArgs(sig, func));

Expand All @@ -59,8 +61,10 @@ static Result<std::pair<std::vector<llvm::Type*>, llvm::Type*>> MapToLLVMSignatu
auto ret_llvm_type = types->IRType(sig.ret_type()->id());
return std::make_pair(std::move(arg_llvm_types), ret_llvm_type);
}
} // namespace

arrow::Status ExternalCFunctions::AddMappings(Engine* engine) const {
namespace gandiva {
Status ExternalCFunctions::AddMappings(Engine* engine) const {
auto const& c_funcs = function_registry_->GetCFunctions();
auto const types = engine->types();
for (auto& [func, func_ptr] : c_funcs) {
Expand All @@ -70,6 +74,6 @@ arrow::Status ExternalCFunctions::AddMappings(Engine* engine) const {
engine->AddGlobalMappingForFunc(func.pc_name(), ret_llvm_type, args, func_ptr);
}
}
return arrow::Status::OK();
return Status::OK();
}
} // namespace gandiva

0 comments on commit a3d0625

Please sign in to comment.