Skip to content

Commit

Permalink
Merge pull request #2570 from isaacault/copy_to_move
Browse files Browse the repository at this point in the history
Fix Coverity COPY_INSTEAD_OF_MOVE defects.
  • Loading branch information
isaacault authored Jan 16, 2025
2 parents 21866c2 + fd899e4 commit af4ab49
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/common/logger/ur_logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix,
map->erase(kv);
}

std::vector<std::string> values = {default_output};
std::vector<std::string> values = {std::move(default_output)};
kv = map->find("output");
if (kv != map->end()) {
values = kv->second;
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/sanitizer/asan/asan_interceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ ur_result_t AsanInterceptor::registerSpirKernels(ur_program_handle_t Program) {
getContext()->logger.info(
"SpirKernel(name='{}', isInstrumented={})", KernelName, true);

PI->InstrumentedKernels.insert(KernelName);
PI->InstrumentedKernels.insert(std::move(KernelName));
}
getContext()->logger.info("Number of sanitized kernel: {}",
PI->InstrumentedKernels.size());
Expand Down
3 changes: 2 additions & 1 deletion source/loader/layers/sanitizer/msan/msan_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ struct MemBuffer {

// Sub-buffer constructor
MemBuffer(std::shared_ptr<MemBuffer> Parent, size_t Origin, size_t Size)
: Context(Parent->Context), Size(Size), SubBuffer{{Parent, Origin}} {}
: Context(Parent->Context),
Size(Size), SubBuffer{{std::move(Parent), Origin}} {}

ur_result_t getHandle(ur_device_handle_t Device, char *&Handle);

Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/sanitizer/msan/msan_interceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ ur_result_t MsanInterceptor::registerSpirKernels(ur_program_handle_t Program) {
getContext()->logger.info(
"SpirKernel(name='{}', isInstrumented={})", KernelName, true);

PI->InstrumentedKernels.insert(KernelName);
PI->InstrumentedKernels.insert(std::move(KernelName));
}
getContext()->logger.info("Number of sanitized kernel: {}",
PI->InstrumentedKernels.size());
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/source/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void KernelsEnvironment::LoadSource(
auto binary_ptr =
std::make_shared<std::vector<char>>(std::move(device_binary));
cached_kernels[kernel_name] = binary_ptr;
binary_out = binary_ptr;
binary_out = std::move(binary_ptr);
}

ur_result_t KernelsEnvironment::CreateProgram(
Expand Down
4 changes: 2 additions & 2 deletions test/conformance/testing/include/uur/known_failure.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace uur {
struct Matcher {
Matcher(uint32_t adapterVersion, ur_adapter_backend_t backend,
std::vector<std::string> deviceNames)
: adapterVersion(adapterVersion), backend(backend), names(deviceNames) {
}
: adapterVersion(adapterVersion), backend(backend),
names(std::move(deviceNames)) {}

uint32_t adapterVersion;
ur_adapter_backend_t backend;
Expand Down

0 comments on commit af4ab49

Please sign in to comment.