refactor: use reference in for-range loops

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-03 15:02:52 +00:00
committed by Compute-Runtime-Automation
parent 9b344280d6
commit 895a586083
16 changed files with 34 additions and 34 deletions

View File

@@ -114,7 +114,7 @@ inline std::string concatenate(T &&arg, RestT &&...rest) {
template <size_t NumOptions>
constexpr size_t concatenationLength(const ConstStringRef (&options)[NumOptions]) {
size_t ret = 0U;
for (auto opt : options) {
for (auto &opt : options) {
ret += spaceSeparatorSize + opt.length();
}
return (ret != 0U) ? ret - nullterminateSize : 0U;
@@ -141,7 +141,7 @@ class ConstConcatenation {
template <size_t NumOptions>
constexpr ConstConcatenation(const ConstStringRef (&options)[NumOptions]) {
size_t i = 0U;
for (auto opt : options) {
for (auto &opt : options) {
for (size_t j = 0U, e = opt.length(); j < e; ++j, ++i) {
storage[i] = opt[j];
}

View File

@@ -216,7 +216,7 @@ void *MemoryManager::createMultiGraphicsAllocationInSystemMemoryPool(RootDeviceI
auto graphicsAllocation = createGraphicsAllocationFromExistingStorage(properties, ptr, multiGraphicsAllocation);
if (!graphicsAllocation) {
for (auto gpuAllocation : multiGraphicsAllocation.getGraphicsAllocations()) {
for (auto &gpuAllocation : multiGraphicsAllocation.getGraphicsAllocations()) {
freeGraphicsMemory(gpuAllocation);
}
return nullptr;

View File

@@ -19,7 +19,7 @@
namespace NEO {
bool Drm::registerResourceClasses() {
for (auto classNameUUID : classNamesToUuid) {
for (auto &classNameUUID : classNamesToUuid) {
auto className = classNameUUID.first;
auto uuid = classNameUUID.second;

View File

@@ -102,7 +102,7 @@ size_t MemoryInfo::getMemoryRegionSize(uint32_t memoryBank) {
}
void MemoryInfo::printRegionSizes() {
for (auto region : drmQueryRegions) {
for (auto &region : drmQueryRegions) {
std::cout << "Memory type: " << region.region.memoryClass
<< ", memory instance: " << region.region.memoryInstance
<< ", region size: " << region.probedSize << std::endl;