Skip to content

Commit a4888b3

Browse files
build: add clang-tidy restriction for Enum case
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 590418a commit a4888b3

File tree

107 files changed

+834
-1367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+834
-1367
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ CheckOptions:
2424
value: CamelCase
2525
- key: readability-identifier-naming.StructIgnoredRegexp
2626
value: '(_|TOKSTR_).+'
27+
- key: readability-identifier-naming.EnumCase
28+
value: CamelCase
2729
- key: readability-identifier-naming.MethodCase
2830
value: camelBack
2931
- key: readability-identifier-naming.PrivateMethodCase

level_zero/core/source/cmdqueue/cmdqueue.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -283,34 +283,34 @@ ze_result_t CommandQueueImp::CommandBufferManager::initialize(Device *device, si
283283
secondBuffer = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
284284
}
285285

286-
buffers[BUFFER_ALLOCATION::FIRST] = firstBuffer;
287-
buffers[BUFFER_ALLOCATION::SECOND] = secondBuffer;
286+
buffers[BufferAllocation::first] = firstBuffer;
287+
buffers[BufferAllocation::second] = secondBuffer;
288288

289-
if (!buffers[BUFFER_ALLOCATION::FIRST] || !buffers[BUFFER_ALLOCATION::SECOND]) {
289+
if (!buffers[BufferAllocation::first] || !buffers[BufferAllocation::second]) {
290290
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
291291
}
292292

293-
flushId[BUFFER_ALLOCATION::FIRST] = std::make_pair(0u, 0u);
294-
flushId[BUFFER_ALLOCATION::SECOND] = std::make_pair(0u, 0u);
293+
flushId[BufferAllocation::first] = std::make_pair(0u, 0u);
294+
flushId[BufferAllocation::second] = std::make_pair(0u, 0u);
295295
return ZE_RESULT_SUCCESS;
296296
}
297297

298298
void CommandQueueImp::CommandBufferManager::destroy(Device *device) {
299-
if (buffers[BUFFER_ALLOCATION::FIRST]) {
300-
device->storeReusableAllocation(*buffers[BUFFER_ALLOCATION::FIRST]);
301-
buffers[BUFFER_ALLOCATION::FIRST] = nullptr;
299+
if (buffers[BufferAllocation::first]) {
300+
device->storeReusableAllocation(*buffers[BufferAllocation::first]);
301+
buffers[BufferAllocation::first] = nullptr;
302302
}
303-
if (buffers[BUFFER_ALLOCATION::SECOND]) {
304-
device->storeReusableAllocation(*buffers[BUFFER_ALLOCATION::SECOND]);
305-
buffers[BUFFER_ALLOCATION::SECOND] = nullptr;
303+
if (buffers[BufferAllocation::second]) {
304+
device->storeReusableAllocation(*buffers[BufferAllocation::second]);
305+
buffers[BufferAllocation::second] = nullptr;
306306
}
307307
}
308308

309309
NEO::WaitStatus CommandQueueImp::CommandBufferManager::switchBuffers(NEO::CommandStreamReceiver *csr) {
310-
if (bufferUse == BUFFER_ALLOCATION::FIRST) {
311-
bufferUse = BUFFER_ALLOCATION::SECOND;
310+
if (bufferUse == BufferAllocation::first) {
311+
bufferUse = BufferAllocation::second;
312312
} else {
313-
bufferUse = BUFFER_ALLOCATION::FIRST;
313+
bufferUse = BufferAllocation::first;
314314
}
315315

316316
auto waitStatus{NEO::WaitStatus::ready};

level_zero/core/source/cmdqueue/cmdqueue_imp.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ struct Kernel;
3636
struct CommandQueueImp : public CommandQueue {
3737
class CommandBufferManager {
3838
public:
39-
enum BUFFER_ALLOCATION : uint32_t {
40-
FIRST = 0,
41-
SECOND,
42-
COUNT
39+
enum BufferAllocation : uint32_t {
40+
first = 0,
41+
second,
42+
count
4343
};
4444

4545
ze_result_t initialize(Device *device, size_t sizeRequested);
@@ -58,9 +58,9 @@ struct CommandQueueImp : public CommandQueue {
5858
}
5959

6060
private:
61-
NEO::GraphicsAllocation *buffers[BUFFER_ALLOCATION::COUNT]{};
62-
std::pair<TaskCountType, NEO::FlushStamp> flushId[BUFFER_ALLOCATION::COUNT];
63-
BUFFER_ALLOCATION bufferUse = BUFFER_ALLOCATION::FIRST;
61+
NEO::GraphicsAllocation *buffers[BufferAllocation::count]{};
62+
std::pair<TaskCountType, NEO::FlushStamp> flushId[BufferAllocation::count];
63+
BufferAllocation bufferUse = BufferAllocation::first;
6464
};
6565
static constexpr size_t defaultQueueCmdBufferSize = 128 * MemoryConstants::kiloByte;
6666
static constexpr size_t minCmdBufferPtrAlign = 8;

level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ class Debugger;
2929

3030
namespace L0 {
3131

32-
typedef enum _ze_rtas_device_format_internal_t {
33-
ZE_RTAS_DEVICE_FORMAT_EXP_INVALID = 0, // invalid acceleration structure format
34-
ZE_RTAS_DEVICE_FORMAT_EXP_VERSION_1 = 1, // acceleration structure format version 1
35-
ZE_RTAS_DEVICE_FORMAT_EXP_VERSION_2 = 2, // acceleration structure format version 2
36-
ZE_RTAS_DEVICE_FORMAT_EXP_VERSION_MAX = 2
37-
} ze_rtas_device_format_internal_t;
32+
enum class RTASDeviceFormatInternal {
33+
version1 = 1,
34+
version2 = 2,
35+
};
3836

3937
struct Event;
4038
struct Device;

level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ NEO::HeapAddressModel L0GfxCoreHelperHw<Family>::getPlatformHeapAddressModel() c
7474

7575
template <typename Family>
7676
ze_rtas_format_exp_t L0GfxCoreHelperHw<Family>::getSupportedRTASFormat() const {
77-
return static_cast<ze_rtas_format_exp_t>(ZE_RTAS_DEVICE_FORMAT_EXP_VERSION_1);
77+
return static_cast<ze_rtas_format_exp_t>(RTASDeviceFormatInternal::version1);
7878
}
7979

8080
template <typename Family>

level_zero/core/test/unit_tests/fixtures/module_fixture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void ModuleImmutableDataFixture::setUp() {
8888
DeviceFixture::setupWithExecutionEnvironment(*executionEnvironment);
8989
}
9090

91-
void ModuleImmutableDataFixture::createModuleFromMockBinary(uint32_t perHwThreadPrivateMemorySize, bool isInternal, MockImmutableData *mockKernelImmData, std::initializer_list<ZebinTestData::appendElfAdditionalSection> additionalSections) {
91+
void ModuleImmutableDataFixture::createModuleFromMockBinary(uint32_t perHwThreadPrivateMemorySize, bool isInternal, MockImmutableData *mockKernelImmData, std::initializer_list<ZebinTestData::AppendElfAdditionalSection> additionalSections) {
9292
DebugManagerStateRestore restore;
9393
debugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
9494

level_zero/core/test/unit_tests/fixtures/module_fixture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
108108
void setUp();
109109

110110
void createModuleFromMockBinary(uint32_t perHwThreadPrivateMemorySize, bool isInternal, MockImmutableData *mockKernelImmData,
111-
std::initializer_list<ZebinTestData::appendElfAdditionalSection> additionalSections = {});
111+
std::initializer_list<ZebinTestData::AppendElfAdditionalSection> additionalSections = {});
112112

113113
void createKernel(MockKernel *kernel);
114114

level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ TEST_F(CommandQueueInitTests, givenMultipleSubDevicesWhenInitializingThenAllocat
723723
}
724724
}
725725

726-
EXPECT_EQ(static_cast<uint32_t>(CommandQueueImp::CommandBufferManager::BUFFER_ALLOCATION::COUNT), cmdBufferAllocationsFound);
726+
EXPECT_EQ(static_cast<uint32_t>(CommandQueueImp::CommandBufferManager::BufferAllocation::count), cmdBufferAllocationsFound);
727727

728728
commandQueue->destroy();
729729
}

level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL
614614
auto debugger = MockDebuggerL0Hw<FamilyType>::allocate(neoDevice);
615615
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
616616

617-
auto elfAdditionalSections = {ZebinTestData::appendElfAdditionalSection::constant}; // for const surface allocation copy
617+
auto elfAdditionalSections = {ZebinTestData::AppendElfAdditionalSection::constant}; // for const surface allocation copy
618618
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo(), elfAdditionalSections);
619619
const auto &src = zebinData->storage;
620620

level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ TEST_F(KernelImmutableDataIsaCopyTests, whenUserKernelIsCreatedThenIsaIsCopiedWh
719719

720720
std::unique_ptr<MockImmutableData> mockKernelImmData = std::make_unique<MockImmutableData>(perHwThreadPrivateMemorySizeRequested);
721721

722-
auto additionalSections = {ZebinTestData::appendElfAdditionalSection::global};
722+
auto additionalSections = {ZebinTestData::AppendElfAdditionalSection::global};
723723
createModuleFromMockBinary(perHwThreadPrivateMemorySizeRequested, isInternal, mockKernelImmData.get(), additionalSections);
724724

725725
size_t copyForGlobalSurface = 1u;
@@ -799,7 +799,7 @@ TEST_F(KernelImmutableDataTests, givenInternalModuleWhenKernelIsCreatedThenIsaIs
799799
size_t previouscopyMemoryToAllocationCalledTimes =
800800
mockMemoryManager->copyMemoryToAllocationCalledTimes;
801801

802-
auto additionalSections = {ZebinTestData::appendElfAdditionalSection::global};
802+
auto additionalSections = {ZebinTestData::AppendElfAdditionalSection::global};
803803
createModuleFromMockBinary(perHwThreadPrivateMemorySizeRequested, isInternal, mockKernelImmData.get(), additionalSections);
804804

805805
size_t copyForGlobalSurface = 1u;

0 commit comments

Comments
 (0)