clang-tidy configuration cleanup

Define single .clang-tidy configuration with all used checks and use
NOLINT to selectively silence tool. That way cleanup should be easier.
third_part/ has its own configuration that disables clang-tidy for this
folder.

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2022-05-09 17:40:30 +00:00
committed by Compute-Runtime-Automation
parent 910871a706
commit e9be9b64c6
235 changed files with 920 additions and 1169 deletions

View File

@@ -35,7 +35,7 @@ struct Context : _ze_context_handle_t {
return ZE_MEMORY_TYPE_UNKNOWN;
}
virtual ~Context() = default;
~Context() override = default;
virtual ze_result_t destroy() = 0;
virtual ze_result_t getStatus() = 0;
virtual DriverHandle *getDriverHandle() = 0;

View File

@@ -414,10 +414,10 @@ ze_result_t DeviceImp::getPciProperties(ze_pci_ext_properties_t *pPciProperties)
}
auto pciBusInfo = driverInfo->getPciBusInfo();
auto isPciValid = [&](auto pci) -> bool {
return (pci.pciDomain != NEO::PhysicalDevicePciBusInfo::InvalidValue &&
pci.pciBus != NEO::PhysicalDevicePciBusInfo::InvalidValue &&
pci.pciDevice != NEO::PhysicalDevicePciBusInfo::InvalidValue &&
pci.pciFunction != NEO::PhysicalDevicePciBusInfo::InvalidValue);
return (pci.pciDomain != NEO::PhysicalDevicePciBusInfo::invalidValue &&
pci.pciBus != NEO::PhysicalDevicePciBusInfo::invalidValue &&
pci.pciDevice != NEO::PhysicalDevicePciBusInfo::invalidValue &&
pci.pciFunction != NEO::PhysicalDevicePciBusInfo::invalidValue);
};
if (!isPciValid(pciBusInfo)) {
return ZE_RESULT_ERROR_UNINITIALIZED;

View File

@@ -57,11 +57,11 @@ struct DriverHandleImp : public DriverHandle {
ze_result_t releaseImportedPointer(void *ptr) override;
ze_result_t getHostPointerBaseAddress(void *ptr, void **baseAddress) override;
virtual NEO::GraphicsAllocation *findHostPointerAllocation(void *ptr, size_t size, uint32_t rootDeviceIndex) override;
virtual NEO::GraphicsAllocation *getDriverSystemMemoryAllocation(void *ptr,
size_t size,
uint32_t rootDeviceIndex,
uintptr_t *gpuAddress) override;
NEO::GraphicsAllocation *findHostPointerAllocation(void *ptr, size_t size, uint32_t rootDeviceIndex) override;
NEO::GraphicsAllocation *getDriverSystemMemoryAllocation(void *ptr,
size_t size,
uint32_t rootDeviceIndex,
uintptr_t *gpuAddress) override;
NEO::GraphicsAllocation *getPeerAllocation(Device *device,
NEO::SvmAllocationData *allocData,
void *basePtr,

View File

@@ -248,7 +248,7 @@ struct EventPoolImp : public EventPool {
ze_result_t initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices);
~EventPoolImp();
~EventPoolImp() override;
ze_result_t destroy() override;

View File

@@ -1,34 +0,0 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,google-default-arguments,modernize-use-override,modernize-use-default-member-init,-clang-analyzer-alpha*,readability-identifier-naming,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-analyzer-core.CallAndMessage,-clang-analyzer-unix.MismatchedDeallocator,-clang-analyzer-core.NullDereference,-clang-analyzer-cplusplus.NewDelete,-clang-analyzer-optin.cplusplus.VirtualCall'
# WarningsAsErrors: '.*'
HeaderFilterRegex: '^((?!^third_party\/).+)\.(h|hpp|inl)$'
AnalyzeTemporaryDtors: false
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.StructMemberCase
value: camelBack
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: modernize-use-default-member-init.UseAssignment
value: '1'
...

View File

@@ -41,9 +41,9 @@ class AUBFixtureL0 {
public:
AUBFixtureL0();
virtual ~AUBFixtureL0();
void SetUp();
void SetUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEnabled);
void TearDown();
void SetUp(); // NOLINT(readability-identifier-naming)
void SetUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEnabled); // NOLINT(readability-identifier-naming)
void TearDown(); // NOLINT(readability-identifier-naming)
static void prepareCopyEngines(NEO::MockDevice &device, const std::string &filename);
template <typename FamilyType>
@@ -110,4 +110,4 @@ class AUBFixtureL0 {
NEO::CommandStreamReceiver *csr = nullptr;
};
} // namespace L0
} // namespace L0

View File

@@ -30,7 +30,7 @@ void testCopyBetweenHeapDeviceAndStack(ze_context_handle_t &context, ze_device_h
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
if (copyQueueGroup < 0) {
std::cout << "No Copy queue group found. Skipping test run\n";
std::cout << "No Copy queue group found. Skipping test run\n"; // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
validRet = true;
return;
}
@@ -105,7 +105,7 @@ void testCopyBetweenHostMemAndDeviceMem(ze_context_handle_t &context, ze_device_
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
if (copyQueueGroup < 0) {
std::cout << "No Copy queue group found. Skipping test run\n";
std::cout << "No Copy queue group found. Skipping test run\n"; // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
validRet = true;
return;
}
@@ -310,7 +310,7 @@ void testSharedMemDataAccessWithoutCopy(ze_context_handle_t &context, ze_device_
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
if (copyQueueGroup < 0) {
std::cout << "No Copy queue group found. Skipping test run\n";
std::cout << "No Copy queue group found. Skipping test run\n"; // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
validRet = true;
return;
}

View File

@@ -64,7 +64,7 @@ static int recvmsgForIpcHandle(int socket, char *payload) {
return -1;
}
struct cmsghdr *controlHeader = CMSG_FIRSTHDR(&msgHeader);
memmove(&fd, CMSG_DATA(controlHeader), sizeof(int));
memmove(&fd, CMSG_DATA(controlHeader), sizeof(int)); // NOLINT(clang-analyzer-core.NonNullParamChecker)
memmove(payload, recvBuf, sizeof(recvBuf));
return fd;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,14 +20,14 @@ namespace L0 {
namespace ult {
struct AubCsrFixture : public ContextFixture {
template <typename T>
void SetUpT() {
void setUpT() {
auto csrCreateFcn = &commandStreamReceiverFactory[IGFX_MAX_CORE + NEO::defaultHwInfo->platform.eRenderCoreFamily];
variableBackup = std::make_unique<VariableBackup<CommandStreamReceiverCreateFunc>>(csrCreateFcn);
*csrCreateFcn = UltAubCommandStreamReceiver<T>::create;
ContextFixture::SetUp();
}
template <typename T>
void TearDownT() {
void tearDownT() {
ContextFixture::TearDown();
}

View File

@@ -18,7 +18,7 @@
namespace L0 {
namespace ult {
void DeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
void DeviceFixture::SetUp() {
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(NEO::defaultHwInfo.get(), 0u);
setupWithExecutionEnvironment(*executionEnvironment);
}
@@ -39,11 +39,11 @@ void DeviceFixture::setupWithExecutionEnvironment(NEO::ExecutionEnvironment &exe
context = static_cast<ContextImp *>(Context::fromHandle(hContext));
}
void DeviceFixture::TearDown() { // NOLINT(readability-identifier-naming)
void DeviceFixture::TearDown() {
context->destroy();
}
void PageFaultDeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
void PageFaultDeviceFixture::SetUp() {
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get());
auto mockBuiltIns = new MockBuiltins();
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
@@ -65,12 +65,12 @@ void PageFaultDeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
device->getDriverHandle()->setMemoryManager(mockMemoryManager.get());
}
void PageFaultDeviceFixture::TearDown() { // NOLINT(readability-identifier-naming)
void PageFaultDeviceFixture::TearDown() {
device->getDriverHandle()->setMemoryManager(memoryManager);
context->destroy();
}
void MultiDeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
void MultiDeviceFixture::SetUp() {
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
@@ -86,7 +86,7 @@ void MultiDeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
context = static_cast<ContextImp *>(Context::fromHandle(hContext));
}
void MultiDeviceFixture::TearDown() { // NOLINT(readability-identifier-naming)
void MultiDeviceFixture::TearDown() {
context->destroy();
}

View File

@@ -183,8 +183,8 @@ struct ContextFixture : DeviceFixture {
};
struct MultipleDevicesWithCustomHwInfo {
void SetUp();
void TearDown() {}
void SetUp(); // NOLINT(readability-identifier-naming)
void TearDown() {} // NOLINT(readability-identifier-naming)
NEO::HardwareInfo hwInfo;
const uint32_t numSubslicesPerSlice = 4;
const uint32_t numEuPerSubslice = 8;
@@ -222,7 +222,7 @@ struct SingleRootMultiSubDeviceFixtureWithImplicitScaling : public MultiDeviceFi
uint32_t numEngineGroups = 0;
uint32_t subDeviceNumEngineGroups = 0;
void SetUp() { // NOLINT(readability-identifier-naming)
void SetUp() {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableImplicitScaling.set(implicitScaling);
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
@@ -283,7 +283,7 @@ struct SingleRootMultiSubDeviceFixtureWithImplicitScaling : public MultiDeviceFi
}
}
void TearDown() { // NOLINT(readability-identifier-naming)
void TearDown() {
context->destroy();
}
};

View File

@@ -25,7 +25,7 @@ namespace L0 {
namespace ult {
struct HostPointerManagerFixure {
void SetUp() {
void SetUp() { // NOLINT(readability-identifier-naming)
NEO::MockCompilerEnableGuard mock(true);
NEO::DeviceVector devices;
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get());
@@ -51,7 +51,7 @@ struct HostPointerManagerFixure {
context = L0::Context::fromHandle(hContext);
}
void TearDown() {
void TearDown() { // NOLINT(readability-identifier-naming)
context->destroy();
hostDriverHandle->getMemoryManager()->freeSystemMemory(heapPointer);

View File

@@ -103,7 +103,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
mockKernelImmData->setDevice(device);
}
~MockModule() {
~MockModule() override {
}
const KernelImmutableData *getKernelImmutableData(const char *functionName) const override {
@@ -317,7 +317,7 @@ struct ModuleWithZebinFixture : public DeviceFixture {
MemoryPool::System4KBPages));
}
~MockImmutableData() {
~MockImmutableData() override {
delete kernelDescriptor;
}
};
@@ -363,7 +363,7 @@ struct ModuleWithZebinFixture : public DeviceFixture {
zebin.storage.data(), zebin.storage.size());
}
~MockModuleWithZebin() {
~MockModuleWithZebin() override {
}
const char strings[12] = "Hello olleH";

View File

@@ -306,7 +306,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierWithInvalidAd
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto commandList = new CommandListAdjustStateComputeMode<productFamily>();
ASSERT_NE(nullptr, commandList);
ASSERT_NE(nullptr, commandList); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
bool ret = commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
ASSERT_FALSE(ret);
@@ -339,7 +339,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierWithInvalidAd
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto commandList = new CommandListAdjustStateComputeMode<productFamily>();
ASSERT_NE(nullptr, commandList);
ASSERT_NE(nullptr, commandList); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
bool ret = commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
ASSERT_FALSE(ret);

View File

@@ -15,7 +15,7 @@ namespace ult {
struct MockBuiltinDataTimestamp : BuiltinFunctionsLibImpl::BuiltinData {
using BuiltinFunctionsLibImpl::BuiltinData::BuiltinData;
~MockBuiltinDataTimestamp() {
~MockBuiltinDataTimestamp() override {
module.release();
}
};
@@ -53,7 +53,7 @@ struct MockBuiltinFunctionsLibImplTimestamps : BuiltinFunctionsLibImpl {
auto builtInCodeType = NEO::DebugManager.flags.RebuildPrecompiledKernels.get() ? BuiltInCodeType::Intermediate : BuiltInCodeType::Binary;
auto builtInCode = builtInsLib->getBuiltinsLib().getBuiltinCode(builtin, builtInCodeType, *device->getNEODevice());
ze_result_t res;
[[maybe_unused]] ze_result_t res;
std::unique_ptr<Module> module;
ze_module_handle_t moduleHandle;
ze_module_desc_t moduleDesc = {};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -27,9 +27,9 @@ class MockDeviceForSpv : public Mock<DeviceImp> {
}
ze_result_t createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override;
~MockDeviceForSpv() {
~MockDeviceForSpv() override {
}
};
} // namespace ult
} // namespace L0
} // namespace L0

View File

@@ -87,7 +87,7 @@ struct MockModule : public L0::ModuleImp {
maxGroupSize = 32;
};
~MockModule() = default;
~MockModule() override = default;
const KernelImmutableData *getKernelImmutableData(const char *functionName) const override {
return kernelImmData;

View File

@@ -407,7 +407,7 @@ HWTEST2_F(CommandListCreate, givenCommandListAndHostPointersWhenMemoryCopyCalled
cmd = genCmdCast<PIPE_CONTROL *>(*itor);
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
}
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable());
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable()); // NOLINT(clang-analyzer-core.CallAndMessage)
}
HWTEST2_F(CommandListCreate, givenCommandListAnd2DWhbufferenMemoryCopyRegionCalledThenCopyKernel2DCalled, IsAtLeastSkl) {

View File

@@ -113,7 +113,7 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyRegionC
cmd = genCmdCast<PIPE_CONTROL *>(*itor);
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
}
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable());
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable()); // NOLINT(clang-analyzer-core.CallAndMessage)
}
HWTEST2_F(AppendMemoryCopy, givenImmediateCommandListWhenAppendingMemoryCopyThenSuccessIsReturned, IsAtLeastSkl) {
@@ -222,7 +222,7 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyCalledT
cmd = genCmdCast<PIPE_CONTROL *>(*itor);
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
}
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable());
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable()); // NOLINT(clang-analyzer-core.CallAndMessage)
}
HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyThenAppendProfilingCalledOnceBeforeAndAfterCommand, IsAtLeastSkl) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,7 +19,7 @@ namespace L0 {
namespace ult {
struct L0DebuggerFixture {
void SetUp() {
void SetUp() { // NOLINT(readability-identifier-naming)
NEO::MockCompilerEnableGuard mock(true);
auto executionEnvironment = new NEO::ExecutionEnvironment();
auto mockBuiltIns = new MockBuiltins();
@@ -51,7 +51,7 @@ struct L0DebuggerFixture {
device = driverHandle->devices[0];
}
void TearDown() {
void TearDown() { // NOLINT(readability-identifier-naming)
}
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;

View File

@@ -24,7 +24,7 @@ namespace L0 {
namespace ult {
struct L0DebuggerLinuxFixture {
void SetUp() {
void SetUp() { // NOLINT(readability-identifier-naming)
auto executionEnvironment = new NEO::ExecutionEnvironment();
auto mockBuiltIns = new MockBuiltins();
executionEnvironment->prepareRootDeviceEnvironments(1);
@@ -48,7 +48,7 @@ struct L0DebuggerLinuxFixture {
device = driverHandle->devices[0];
}
void TearDown() {
void TearDown() { // NOLINT(readability-identifier-naming)
}
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;

View File

@@ -243,12 +243,12 @@ TEST_F(DeviceWithDebuggerEnabledTest, givenSldDebuggerWhenGettingL0DebuggerThenN
}
struct TwoSubDevicesDebuggerEnabledTest : public ActiveDebuggerFixture, public ::testing::Test {
void SetUp() override { // NOLINT(readability-identifier-naming)
void SetUp() override {
DebugManager.flags.CreateMultipleSubDevices.set(2);
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
ActiveDebuggerFixture::SetUp();
}
void TearDown() override { // NOLINT(readability-identifier-naming)
void TearDown() override {
ActiveDebuggerFixture::TearDown();
}
DebugManagerStateRestore restorer;

View File

@@ -1146,7 +1146,7 @@ TEST_F(DeviceTest, givenValidPciExtPropertiesWhenPciPropertiesIsCalledThenSucces
}
TEST_F(DeviceTest, givenInvalidPciBusInfoWhenPciPropertiesIsCalledThenUninitializedErrorIsReturned) {
constexpr uint32_t INVALID = NEO::PhysicalDevicePciBusInfo::InvalidValue;
constexpr uint32_t INVALID = NEO::PhysicalDevicePciBusInfo::invalidValue;
auto deviceImp = static_cast<L0::DeviceImp *>(device);
ze_pci_ext_properties_t pciProperties = {};
std::vector<NEO::PhysicalDevicePciBusInfo> pciBusInfos;