提交 697ffc1a 编写于 作者: S Shreedhar Hardikar

Fix cpplint errors

上级 d0ef76db
......@@ -130,7 +130,10 @@ ClassType* CodegenEnroll(FuncType regular_func_ptr,
}
ClassType* generator = new ClassType(
manager, regular_func_ptr, ptr_to_chosen_func_ptr, std::forward<Args>(args)...);
manager,
regular_func_ptr,
ptr_to_chosen_func_ptr,
std::forward<Args>(args)...);
bool is_enrolled = manager->EnrollCodeGenerator(
CodegenFuncLifespan_Parameter_Invariant, generator);
assert(is_enrolled);
......
......@@ -126,7 +126,8 @@ bool ExecEvalExprCodegen::GenerateExecEvalExpr(
"slot_getattr");
} else {
slot_getattr_codegen_->GenerateCode(codegen_utils);
gen_info_.llvm_slot_getattr_func = slot_getattr_codegen_->GetGeneratedFunction();
gen_info_.llvm_slot_getattr_func =
slot_getattr_codegen_->GetGeneratedFunction();
}
llvm::Function* exec_eval_expr_func = CreateFunction<ExecEvalExprFn>(
......
......@@ -148,7 +148,8 @@ bool ExecVariableListCodegen::GenerateExecVariableList(
// Generate slot_getattr for attributes all the way to max_attr
assert(nullptr != slot_getattr_codegen_);
slot_getattr_codegen_->GenerateCode(codegen_utils);
llvm::Function* slot_getattr_func = slot_getattr_codegen_->GetGeneratedFunction();
llvm::Function* slot_getattr_func =
slot_getattr_codegen_->GetGeneratedFunction();
// In case the above generation failed, no point in continuing since that was
// the most crucial part of ExecVariableList code generation.
......
......@@ -148,7 +148,8 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
int max_attr_;
// Primary function to be generated and populated
llvm::Function* llvm_function_;
// A dummy function pointer that can be swapped by the BaseCodegen implementation
// A dummy function pointer that can be swapped by the BaseCodegen
// implementation
SlotGetAttrFn dummy_func_;
static constexpr char kSlotGetAttrPrefix[] = "slot_getattr";
......@@ -165,9 +166,10 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
*
* Map of the form: { manager -> { slot -> slot_getattr_codegen } }
*/
typedef std::unordered_map<TupleTableSlot*, SlotGetAttrCodegen*> SlotGetAttrCodegenCache;
static std::unordered_map<gpcodegen::CodegenManager*, SlotGetAttrCodegenCache> codegen_cache_by_manager;
typedef std::unordered_map<TupleTableSlot*, SlotGetAttrCodegen*>
SlotGetAttrCodegenCache;
static std::unordered_map<gpcodegen::CodegenManager*, SlotGetAttrCodegenCache>
codegen_cache_by_manager;
};
/** @} */
......
......@@ -56,8 +56,9 @@ constexpr char SlotGetAttrCodegen::kSlotGetAttrPrefix[];
// attributes is varlen.
extern const int codegen_varlen_tolerance;
std::unordered_map<gpcodegen::CodegenManager*,
SlotGetAttrCodegen::SlotGetAttrCodegenCache> SlotGetAttrCodegen::codegen_cache_by_manager;
std::unordered_map<
gpcodegen::CodegenManager*, SlotGetAttrCodegen::SlotGetAttrCodegenCache>
SlotGetAttrCodegen::codegen_cache_by_manager;
SlotGetAttrCodegen* SlotGetAttrCodegen::GetCodegenInstance(
gpcodegen::CodegenManager* manager,
......@@ -88,7 +89,9 @@ SlotGetAttrCodegen* SlotGetAttrCodegen::GetCodegenInstance(
void SlotGetAttrCodegen::RemoveSelfFromCache() {
CodegenManager* manager = this->manager();
assert(manager != nullptr && codegen_cache_by_manager.find(manager) != codegen_cache_by_manager.end());
assert(manager != nullptr &&
codegen_cache_by_manager.find(manager) !=
codegen_cache_by_manager.end());
std::unordered_map<TupleTableSlot*, SlotGetAttrCodegen*>& cache_map =
codegen_cache_by_manager[manager];
auto it = codegen_cache_by_manager[manager].find(slot_);
......@@ -110,7 +113,8 @@ SlotGetAttrCodegen::~SlotGetAttrCodegen() {
bool SlotGetAttrCodegen::GenerateCodeInternal(
gpcodegen::GpCodegenUtils* codegen_utils) {
// This function may be called multiple times, but it should generate code only once
// This function may be called multiple times, but it should generate code
// only once
if (IsGenerated()) {
return true;
}
......@@ -119,9 +123,11 @@ bool SlotGetAttrCodegen::GenerateCodeInternal(
std::string function_name = GetUniqueFuncName() + "_" +
std::to_string(reinterpret_cast<uint64_t>(slot_)) + "_" +
std::to_string(max_attr_);
llvm::Function* function = CreateFunction<SlotGetAttrFn>(codegen_utils, function_name);
llvm::Function* function = CreateFunction<SlotGetAttrFn>(codegen_utils,
function_name);
bool isGenerated = GenerateSlotGetAttr(codegen_utils, slot_, max_attr_, function);
bool isGenerated = GenerateSlotGetAttr(
codegen_utils, slot_, max_attr_, function);
if (isGenerated) {
elog(DEBUG1, "slot_getattr was generated successfully!");
......
......@@ -342,7 +342,8 @@ class CodegenManagerTest : public ::testing::Test {
template <typename ClassType, typename FuncType>
void EnrollCodegen(FuncType reg_func, FuncType* ptr_to_chosen_func) {
ClassType* code_gen = new ClassType(manager_.get(), reg_func, ptr_to_chosen_func);
ClassType* code_gen = new ClassType(
manager_.get(), reg_func, ptr_to_chosen_func);
ASSERT_TRUE(reg_func == *ptr_to_chosen_func);
ASSERT_TRUE(manager_->EnrollCodeGenerator(
CodegenFuncLifespan_Parameter_Invariant,
......@@ -355,12 +356,14 @@ class CodegenManagerTest : public ::testing::Test {
const std::vector<CppType>& values) {
DatumCastFn<Datum, CppType> CppToDatumCgFn = CppToDatumReg;
CppToDatumCastGenerator<CppType>* cpp_datum_gen =
new CppToDatumCastGenerator<CppType>(manager_.get(), CppToDatumReg, &CppToDatumCgFn);
new CppToDatumCastGenerator<CppType>(
manager_.get(), CppToDatumReg, &CppToDatumCgFn);
DatumCastFn<CppType, Datum> DatumToCppCgFn = DatumToCppReg;
DatumToCppCastGenerator<CppType>* datum_cpp_gen =
new DatumToCppCastGenerator<CppType>(manager_.get(), DatumToCppReg, &DatumToCppCgFn);
new DatumToCppCastGenerator<CppType>(
manager_.get(), DatumToCppReg, &DatumToCppCgFn);
ASSERT_TRUE(manager_->EnrollCodeGenerator(
CodegenFuncLifespan_Parameter_Invariant, cpp_datum_gen));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册