fix: Add asserts to ensure NonCopyable and NonMovable 3/n

Related-To: NEO-14068

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2025-02-18 14:35:36 +00:00
committed by Compute-Runtime-Automation
parent ff9d0d7ea0
commit 6b6202446b
33 changed files with 191 additions and 164 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "igfxfmid.h"
#include <memory>
@@ -14,15 +16,10 @@
class MessagePrinter;
struct IgaWrapper {
struct IgaWrapper : NEO::NonCopyableAndNonMovableClass {
IgaWrapper();
MOCKABLE_VIRTUAL ~IgaWrapper();
IgaWrapper(IgaWrapper &) = delete;
IgaWrapper(const IgaWrapper &&) = delete;
IgaWrapper &operator=(const IgaWrapper &) = delete;
IgaWrapper &operator=(IgaWrapper &&) = delete;
MOCKABLE_VIRTUAL bool tryDisassembleGenISA(const void *kernelPtr, uint32_t kernelSize, std::string &out);
MOCKABLE_VIRTUAL bool tryAssembleGenISA(const std::string &inAsm, std::string &outBinary);
@@ -41,3 +38,5 @@ struct IgaWrapper {
MessagePrinter *messagePrinter = nullptr;
};
static_assert(NEO::NonCopyableAndNonMovable<IgaWrapper>);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <sstream>
#include <string>
#include <vector>
@@ -15,10 +17,8 @@ class OclocArgHelper;
namespace NEO {
class MultiCommand {
class MultiCommand : NEO::NonCopyableAndNonMovableClass {
public:
MultiCommand &operator=(const MultiCommand &) = delete;
MultiCommand(const MultiCommand &) = delete;
MOCKABLE_VIRTUAL ~MultiCommand() = default;
static MultiCommand *create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper);
@@ -45,4 +45,7 @@ class MultiCommand {
std::stringstream outputFile;
bool quiet = false;
};
static_assert(NEO::NonCopyableAndNonMovable<MultiCommand>);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/const_stringref.h"
@@ -23,14 +24,11 @@ namespace Ar {
struct Ar;
}
class OclocConcat {
class OclocConcat : NEO::NonCopyableAndNonMovableClass {
public:
using ErrorCode = uint32_t;
OclocConcat() = delete;
OclocConcat(const OclocConcat &) = delete;
OclocConcat &operator=(const OclocConcat &) = delete;
OclocConcat(OclocArgHelper *argHelper) : argHelper(argHelper){};
ErrorCode initialize(const std::vector<std::string> &args);
ErrorCode concatenate();
@@ -53,4 +51,7 @@ Usage: ocloc concat <fat binary> <fat binary> ... [-out <concatenated fat binary
std::vector<std::string> fileNamesToConcat;
std::string fatBinaryName = "concat.ar";
};
static_assert(NEO::NonCopyableAndNonMovable<OclocConcat>);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "cif/common/cif_main.h"
#include "cif/import/library_api.h"
#include "igfxfmid.h"
@@ -25,16 +27,11 @@ class OsLibrary;
struct HardwareInfo;
class OclocFclFacade {
class OclocFclFacade : NEO::NonCopyableAndNonMovableClass {
public:
OclocFclFacade(OclocArgHelper *argHelper);
MOCKABLE_VIRTUAL ~OclocFclFacade();
OclocFclFacade(OclocFclFacade &) = delete;
OclocFclFacade(const OclocFclFacade &&) = delete;
OclocFclFacade &operator=(const OclocFclFacade &) = delete;
OclocFclFacade &operator=(OclocFclFacade &&) = delete;
int initialize(const HardwareInfo &hwInfo);
bool isInitialized() const;
IGC::CodeType::CodeType_t getPreferredIntermediateRepresentation() const;
@@ -59,4 +56,6 @@ class OclocFclFacade {
bool initialized{false};
};
static_assert(NEO::NonCopyableAndNonMovable<OclocFclFacade>);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "cif/common/cif_main.h"
#include "cif/import/library_api.h"
#include "ocl_igc_interface/code_type.h"
@@ -24,16 +26,11 @@ class OsLibrary;
struct HardwareInfo;
class OclocIgcFacade {
class OclocIgcFacade : NEO::NonCopyableAndNonMovableClass {
public:
OclocIgcFacade(OclocArgHelper *argHelper);
MOCKABLE_VIRTUAL ~OclocIgcFacade();
OclocIgcFacade(OclocIgcFacade &) = delete;
OclocIgcFacade(const OclocIgcFacade &&) = delete;
OclocIgcFacade &operator=(const OclocIgcFacade &) = delete;
OclocIgcFacade &operator=(OclocIgcFacade &&) = delete;
int initialize(const HardwareInfo &hwInfo);
bool isInitialized() const;
const char *getIgcRevision();
@@ -66,4 +63,6 @@ class OclocIgcFacade {
bool initialized{false};
};
} // namespace NEO
static_assert(NEO::NonCopyableAndNonMovable<OclocIgcFacade>);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "shared/offline_compiler/source/ocloc_api.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/const_stringref.h"
@@ -44,7 +45,7 @@ static_assert(sizeof(NameVersionPair) == sizeof(ocloc_name_version));
const HardwareInfo *getHwInfoForDeprecatedAcronym(const std::string &deviceName);
class OfflineCompiler {
class OfflineCompiler : NEO::NonCopyableAndNonMovableClass {
public:
static std::vector<NameVersionPair> getExtensions(ConstStringRef product, bool needVersions, OclocArgHelper *helper);
static std::vector<NameVersionPair> getOpenCLCVersions(ConstStringRef product, OclocArgHelper *helper);
@@ -110,8 +111,6 @@ that correspond to the given name.
All supported acronyms: %s.
)OCLOC_HELP";
OfflineCompiler &operator=(const OfflineCompiler &) = delete;
OfflineCompiler(const OfflineCompiler &) = delete;
MOCKABLE_VIRTUAL ~OfflineCompiler();
bool isQuiet() const {
@@ -243,4 +242,6 @@ All supported acronyms: %s.
OclocArgHelper *argHelper = nullptr;
};
static_assert(NEO::NonCopyableAndNonMovable<OfflineCompiler>);
} // namespace NEO