Skip to content

Commit

Permalink
Use same parameter name in declaration and implementation.
Browse files Browse the repository at this point in the history
clang-tidy finding [readability-inconsistent-declaration-parameter-name]

#xls-build-gardener

PiperOrigin-RevId: 684499536
  • Loading branch information
hzeller authored and copybara-github committed Oct 10, 2024
1 parent d7fec15 commit 4d424fd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions xls/contrib/integrator/ir_integrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class IntegrationFunction {
// Helper function for UnifyIntegrationNodesWithGlobalMuxSelect that handles
// the cases that one of the input nodes is a pre-existing mux. The other
// input is a node that will be added as a case(s) to the mux.
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name)
absl::StatusOr<UnifiedNode> UnifyIntegrationNodesWithGlobalMuxSelectNoMuxArg(
Node* mux, Node* case_node);

Expand Down
8 changes: 4 additions & 4 deletions xls/contrib/mlir/IR/xls_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,20 @@ LogicalResult TupleOp::inferReturnTypes(
}

void ForOp::getAsmBlockArgumentNames(Region& region,
OpAsmSetValueNameFn setFn) {
OpAsmSetValueNameFn setNameFn) {
for (auto& block : region.getBlocks()) {
if (block.getArguments().size() !=
getInits().size() + getInvariants().size() + 1) {
// Validation error.
return;
}
int argNum = 0;
setFn(block.getArgument(argNum++), "indvar");
setNameFn(block.getArgument(argNum++), "indvar");
for (auto _ : getInits()) {
setFn(block.getArgument(argNum++), "carry");
setNameFn(block.getArgument(argNum++), "carry");
}
for (auto _ : getInvariants()) {
setFn(block.getArgument(argNum++), "invariant");
setNameFn(block.getArgument(argNum++), "invariant");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion xls/dslx/ir_convert/ir_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ absl::StatusOr<PackageConversionData> ConvertModuleToPackage(
// inside of it, it may not be nullptr.
absl::Status ConvertModuleIntoPackage(Module* module, ImportData* import_data,
const ConvertOptions& options,
PackageConversionData* conv);
PackageConversionData* package);

// Wrapper around ConvertModuleToPackage that converts to IR text.
absl::StatusOr<std::string> ConvertModule(Module* module,
Expand Down
6 changes: 3 additions & 3 deletions xls/ir/block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ absl::Span<InstantiationOutput* const> Block::GetInstantiationOutputs(
absl::StatusOr<Block*> Block::Clone(
std::string_view new_name, Package* target_package,
const absl::flat_hash_map<std::string, std::string>& reg_name_map,
const absl::flat_hash_map<const Block*, Block*>& block_instantation_map)
const absl::flat_hash_map<const Block*, Block*>& block_instantiation_map)
const {
absl::flat_hash_map<Node*, Node*> original_to_clone;
absl::flat_hash_map<Register*, Register*> register_map;
Expand Down Expand Up @@ -757,13 +757,13 @@ absl::StatusOr<Block*> Block::Clone(
XLS_ASSIGN_OR_RETURN(BlockInstantiation * block_inst,
inst->AsBlockInstantiation());
Block* new_inst;
if (!block_instantation_map.contains(block_inst->instantiated_block())) {
if (!block_instantiation_map.contains(block_inst->instantiated_block())) {
XLS_RET_CHECK_EQ(target_package, package())
<< "No definition of block " << block_inst->name() << "("
<< block_inst->instantiated_block()->name() << ") provided.";
new_inst = block_inst->instantiated_block();
} else {
new_inst = block_instantation_map.at(block_inst->instantiated_block());
new_inst = block_instantiation_map.at(block_inst->instantiated_block());
}
XLS_ASSIGN_OR_RETURN(
instantiation_map[inst],
Expand Down
6 changes: 3 additions & 3 deletions xls/jit/function_jit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ absl::StatusOr<JitObjectCode> FunctionJit::CreateObjectCode(
}

absl::StatusOr<std::unique_ptr<FunctionJit>> FunctionJit::CreateInternal(
Function* xls_function, int64_t opt_level, bool has_observer_callbacks,
Function* xls_function, int64_t opt_level, bool include_observer_callbacks,
JitObserver* jit_observer) {
XLS_ASSIGN_OR_RETURN(
auto orc_jit,
OrcJit::Create(opt_level, has_observer_callbacks, jit_observer));
OrcJit::Create(opt_level, include_observer_callbacks, jit_observer));
XLS_ASSIGN_OR_RETURN(llvm::DataLayout data_layout,
orc_jit->CreateDataLayout());
XLS_ASSIGN_OR_RETURN(auto function_base,
JittedFunctionBase::Build(xls_function, *orc_jit));

return std::unique_ptr<FunctionJit>(new FunctionJit(
xls_function, std::move(orc_jit), std::move(function_base),
has_observer_callbacks, std::make_unique<JitRuntime>(data_layout)));
include_observer_callbacks, std::make_unique<JitRuntime>(data_layout)));
}

absl::StatusOr<InterpreterResult<Value>> FunctionJit::Run(
Expand Down
2 changes: 1 addition & 1 deletion xls/jit/ir_builder_visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class NodeIrContext {
void FinalizeWithValue(llvm::Value* result,
std::optional<llvm::IRBuilder<>*> exit_builder,
std::optional<llvm::Value*> return_value,
std::optional<Type*> result_type = std::nullopt);
std::optional<Type*> return_type = std::nullopt);
void FinalizeWithPointerToValue(
llvm::Value* result_buffer,
std::optional<llvm::IRBuilder<>*> exit_builder,
Expand Down
6 changes: 3 additions & 3 deletions xls/public/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,15 @@ bool xls_function_get_name(struct xls_function* function, char** error_out,
}

bool xls_function_get_type(struct xls_function* function, char** error_out,
xls_function_type** result_out) {
xls_function_type** xls_fn_type_out) {
CHECK(function != nullptr);
CHECK(error_out != nullptr);
CHECK(result_out != nullptr);
CHECK(xls_fn_type_out != nullptr);
xls::Function* xls_function = reinterpret_cast<xls::Function*>(function);
xls::FunctionType* type = xls_function->GetType();

*error_out = nullptr;
*result_out = reinterpret_cast<xls_function_type*>(type);
*xls_fn_type_out = reinterpret_cast<xls_function_type*>(type);
return true;
}

Expand Down

0 comments on commit 4d424fd

Please sign in to comment.