fix: fix issues with clang-tidy on Windows

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-11-15 15:16:21 +00:00
committed by Compute-Runtime-Automation
parent 801d5fc48e
commit 140532f8b6
6 changed files with 32 additions and 25 deletions

View File

@@ -212,7 +212,7 @@ size_t APITracerContextImp::updateTracerArrays() {
// from this thread to the tracing threads.
//
activeTracerArray.store(newTracerArray, std::memory_order_release);
return testAndFreeRetiredTracers();
return testAndFreeRetiredTracers(); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
}
ze_result_t APITracerContextImp::enableTracingImp(struct APITracerImp *tracerImp, ze_bool_t enable) {

View File

@@ -89,7 +89,7 @@ class Command : public IFNode<Command> {
Command(CommandQueue &commandQueue);
Command(CommandQueue &commandQueue, std::unique_ptr<KernelOperation> &kernelOperation);
virtual ~Command();
~Command() override;
virtual LinearStream *getCommandStream() {
return nullptr;
}

View File

@@ -268,7 +268,7 @@ std::vector<DeviceVector> Platform::groupDevices(DeviceVector devices) {
outDevices[platformId].push_back(std::move(device));
}
std::sort(outDevices.begin(), outDevices.end(), [](DeviceVector &lhs, DeviceVector &rhs) -> bool {
return lhs[0]->getHardwareInfo().platform.eProductFamily > rhs[0]->getHardwareInfo().platform.eProductFamily;
return lhs[0]->getHardwareInfo().platform.eProductFamily > rhs[0]->getHardwareInfo().platform.eProductFamily; // NOLINT(clang-analyzer-cplusplus.Move)
});
return outDevices;
}

View File

@@ -93,7 +93,7 @@ void PrintFormatter::printString(const char *formatString, const std::function<v
}
void PrintFormatter::stripVectorFormat(const char *format, char *stripped) {
while (*format != '\0') {
while (*format != '\0') { // //NOLINT(clang-analyzer-core.UndefinedBinaryOperatorResult)
if (*format != 'v') {
*stripped = *format;
} else if (*(format + 1) != '1') {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -38,6 +38,7 @@ struct IFNode {
: next(nullptr) {
}
virtual ~IFNode() = default;
void insertOneNext(NodeObjectType &nd) {
nd.next = next;
next = &nd;
@@ -191,6 +192,6 @@ class IFRefList : public IFList<IFNodeRef<NodeObjectType>, ThreadSafe, OwnsNodes
auto up = std::unique_ptr<IFNodeRef<NodeObjectType>>(new IFNodeRef<NodeObjectType>(&node));
this->pushFrontOne(*up);
up.release();
}
} // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
};
} // namespace NEO

View File

@@ -26,7 +26,7 @@ struct DummyFNode : IFNode<DummyFNode> {
DummyFNode(uint32_t *destructorsCounter = nullptr)
: destructorsCounter(destructorsCounter) {
}
~DummyFNode() {
~DummyFNode() override {
if (destructorsCounter != nullptr) {
++(*destructorsCounter);
}
@@ -35,7 +35,7 @@ struct DummyFNode : IFNode<DummyFNode> {
void setPrev(DummyFNode *) {
}
uint32_t *destructorsCounter;
uint32_t *destructorsCounter = nullptr;
};
struct DummyDNode : IDNode<DummyDNode> {
@@ -284,27 +284,33 @@ TEST(IFList, WhenExchangingHeadThenResultIsCorrect) {
template <bool ThreadSafe>
void iFRefListTestPushFrontOne() {
auto list = std::unique_ptr<IFRefList<DummyFNode, ThreadSafe, true>>(new IFRefList<DummyFNode, ThreadSafe, true>());
ASSERT_TRUE(list->peekIsEmpty());
uint32_t destructorCounter = 0;
{
auto list = std::unique_ptr<IFRefList<DummyFNode, ThreadSafe, true>>(new IFRefList<DummyFNode, ThreadSafe, true>());
ASSERT_TRUE(list->peekIsEmpty());
DummyFNode node1;
node1.next = nullptr; // garbage
list->pushRefFrontOne(node1);
ASSERT_FALSE(list->peekIsEmpty());
ASSERT_EQ(&node1, list->peekHead()->ref);
ASSERT_EQ(nullptr, node1.next);
DummyFNode node1(&destructorCounter);
node1.next = nullptr; // garbage
list->pushRefFrontOne(node1);
ASSERT_FALSE(list->peekIsEmpty());
ASSERT_EQ(&node1, list->peekHead()->ref);
ASSERT_EQ(nullptr, node1.next);
DummyFNode node2;
node2.next = nullptr; // garbage
list->pushRefFrontOne(node2);
ASSERT_FALSE(list->peekIsEmpty());
ASSERT_EQ(&node2, list->peekHead()->ref);
ASSERT_EQ(nullptr, node2.next);
DummyFNode node2(&destructorCounter);
node2.next = nullptr; // garbage
list->pushRefFrontOne(node2);
ASSERT_FALSE(list->peekIsEmpty());
ASSERT_EQ(&node2, list->peekHead()->ref);
ASSERT_EQ(nullptr, node2.next);
ASSERT_EQ(&node2, list->peekHead()->ref);
ASSERT_EQ(&node1, list->peekHead()->next->ref);
ASSERT_EQ(&node2, list->peekHead()->ref);
ASSERT_EQ(&node1, list->peekHead()->next->ref);
list.reset();
EXPECT_EQ(0u, destructorCounter);
list.reset();
EXPECT_EQ(0u, destructorCounter);
}
EXPECT_EQ(2u, destructorCounter);
}
TEST(IFRefList, GivenThreadSafeWhenPushingFrontOneThenResultIsCorrect) {