Fix -Wextra-semi-stmt -Wsuggest-destructor-override -Wdeprecated-copy-dtor (#4164)

* Fix -Wextra-semi-stmt
* Fix -Wsuggest-destructor-override
* Fix -Wdeprecated-copy-dtor
This commit is contained in:
Corentin Wallez 2021-03-09 13:16:43 +00:00 коммит произвёл GitHub
Родитель c6da5e343c
Коммит 4a59fd4763
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -58,7 +58,7 @@ class ConstantManager;
class Constant {
public:
Constant() = delete;
virtual ~Constant() {}
virtual ~Constant() = default;
// Make a deep copy of this constant.
virtual std::unique_ptr<Constant> Copy() const = 0;

Просмотреть файл

@ -470,7 +470,7 @@ uint32_t PerformFloatingPointOperation(analysis::ConstantManager* const_mgr,
float fval = val.getAsFloat(); \
if (!IsValidResult(fval)) return 0; \
words = val.GetWords(); \
}
} static_assert(true, "require extra semicolon")
switch (opcode) {
case SpvOpFMul:
FOLD_OP(*);
@ -522,7 +522,7 @@ uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr,
uint32_t val = input1->GetU32() op input2->GetU32(); \
words.push_back(val); \
} \
}
} static_assert(true, "require extra semicalon")
switch (opcode) {
case SpvOpIMul:
FOLD_OP(*);

Просмотреть файл

@ -37,7 +37,7 @@ class InlinePass : public Pass {
using cbb_ptr = const BasicBlock*;
public:
virtual ~InlinePass() = default;
virtual ~InlinePass() override = default;
protected:
InlinePass();

Просмотреть файл

@ -38,7 +38,7 @@ namespace opt {
// utility functions and supporting state.
class MemPass : public Pass {
public:
virtual ~MemPass() = default;
virtual ~MemPass() override = default;
// Returns an undef value for the given |var_id|'s type.
uint32_t GetUndefVal(uint32_t var_id) {

Просмотреть файл

@ -223,7 +223,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) {
case Type::k##kind: \
typeInst = MakeUnique<Instruction>(context(), SpvOpType##kind, 0, id, \
std::initializer_list<Operand>{}); \
break;
break
DefineParameterlessCase(Void);
DefineParameterlessCase(Bool);
DefineParameterlessCase(Sampler);
@ -513,7 +513,7 @@ Type* TypeManager::RebuildType(const Type& type) {
#define DefineNoSubtypeCase(kind) \
case Type::k##kind: \
rebuilt_ty.reset(type.Clone().release()); \
return type_pool_.insert(std::move(rebuilt_ty)).first->get();
return type_pool_.insert(std::move(rebuilt_ty)).first->get()
DefineNoSubtypeCase(Void);
DefineNoSubtypeCase(Bool);

Просмотреть файл

@ -101,7 +101,7 @@ class Type {
Type(Kind k) : kind_(k) {}
virtual ~Type() {}
virtual ~Type() = default;
// Attaches a decoration directly on this type.
void AddDecoration(std::vector<uint32_t>&& d) {

Просмотреть файл

@ -1619,7 +1619,7 @@ spv_result_t CheckLocationDecoration(ValidationState_t& vstate,
{ \
spv_result_t e##LINE = (X); \
if (e##LINE != SPV_SUCCESS) return e##LINE; \
}
} static_assert(true, "require extra semicolon")
#define PASS_OR_BAIL(X) PASS_OR_BAIL_AT_LINE(X, __LINE__)
// Check rules for decorations where we start from the decoration rather

Просмотреть файл

@ -188,7 +188,7 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) {
case SpvOpTypeStruct: {
if (!composites) return fail();
break;
};
}
default:
return fail();

Просмотреть файл

@ -1736,7 +1736,7 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04733);
default:
return ""; // unknown id
};
}
// clang-format on
}

Просмотреть файл

@ -198,7 +198,7 @@ ParsedInstruction MakeParsedInt32TypeInstruction(uint32_t result_id) {
class BinaryParseTest : public spvtest::TextToBinaryTestBase<::testing::Test> {
protected:
~BinaryParseTest() { spvDiagnosticDestroy(diagnostic_); }
~BinaryParseTest() override { spvDiagnosticDestroy(diagnostic_); }
void Parse(const SpirvVector& words, spv_result_t expected_result,
bool flip_words = false) {

Просмотреть файл

@ -36,12 +36,12 @@ class BinaryToText : public ::testing::Test {
public:
BinaryToText()
: context(spvContextCreate(SPV_ENV_UNIVERSAL_1_0)), binary(nullptr) {}
~BinaryToText() {
~BinaryToText() override {
spvBinaryDestroy(binary);
spvContextDestroy(context);
}
virtual void SetUp() {
void SetUp() override {
const char* textStr = R"(
OpSource OpenCL_C 12
OpMemoryModel Physical64 OpenCL
@ -72,7 +72,7 @@ class BinaryToText : public ::testing::Test {
ASSERT_EQ(SPV_SUCCESS, error);
}
virtual void TearDown() {
void TearDown() override {
spvBinaryDestroy(binary);
binary = nullptr;
}

Просмотреть файл

@ -35,7 +35,7 @@ class TestInstruction : public Instruction {
public:
TestInstruction() : Instruction() { created_instructions_.push_back(this); }
~TestInstruction() { deleted_instructions_.push_back(this); }
~TestInstruction() override{ deleted_instructions_.push_back(this); }
static std::vector<TestInstruction*> created_instructions_;
static std::vector<TestInstruction*> deleted_instructions_;

Просмотреть файл

@ -46,7 +46,7 @@ class TextToBinaryTestBase : public T {
text = {textStr, strlen(textStr)};
}
virtual ~TextToBinaryTestBase() {
~TextToBinaryTestBase() override {
DestroyBinary();
if (diagnostic) spvDiagnosticDestroy(diagnostic);
}

Просмотреть файл

@ -835,7 +835,7 @@ class OpTypeArrayLengthTest
position_(spv_position_t{0, 0, 0}),
diagnostic_(spvDiagnosticCreate(&position_, "")) {}
~OpTypeArrayLengthTest() { spvDiagnosticDestroy(diagnostic_); }
~OpTypeArrayLengthTest() override { spvDiagnosticDestroy(diagnostic_); }
// Runs spvValidate() on v, printing any errors via spvDiagnosticPrint().
spv_result_t Val(const SpirvVector& v, const std::string& expected_err = "") {

Просмотреть файл

@ -43,7 +43,7 @@ class ValidationStateTest : public testing::Test {
options_(spvValidatorOptionsCreate()),
state_(context_, options_, kFakeBinary, 0, 1) {}
~ValidationStateTest() {
~ValidationStateTest() override {
spvContextDestroy(context_);
spvValidatorOptionsDestroy(options_);
}

Просмотреть файл

@ -601,7 +601,7 @@ def generate_extension_to_string_mapping(extensions):
' return "{extension}";\n'
function += ''.join([template.format(extension=extension)
for extension in extensions])
function += ' };\n\n return "";\n}'
function += ' }\n\n return "";\n}'
return function
@ -647,7 +647,7 @@ def generate_capability_to_string_mapping(operand_kinds):
function += ' case SpvCapabilityMax:\n' \
' assert(0 && "Attempting to convert SpvCapabilityMax to string");\n' \
' return "";\n'
function += ' };\n\n return "";\n}'
function += ' }\n\n return "";\n}'
return function