Skip to content

Commit a9d3819

Browse files
authored
Fix -Werror=non-virtual-dtor -Werror=suggest-override errors (#1016)
Fixed the following warnings: - "has virtual functions and accessible non-virtual destructor" - runOnModule "can be marked override"
1 parent ceffb80 commit a9d3819

File tree

6 files changed

+8
-2
lines changed

6 files changed

+8
-2
lines changed

lib/SPIRV/OCLToSPIRV.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static size_t getOCLCpp11AtomicMaxNumOps(StringRef Name) {
7373
class OCLToSPIRVBase : public InstVisitor<OCLToSPIRVBase> {
7474
public:
7575
OCLToSPIRVBase() : M(nullptr), Ctx(nullptr), CLVer(0) {}
76+
virtual ~OCLToSPIRVBase() {}
7677
bool runOCLToSPIRV(Module &M);
7778

7879
virtual void visitCallInst(CallInst &CI);

lib/SPIRV/SPIRVLowerBool.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace SPIRV {
5454
class SPIRVLowerBoolBase : public InstVisitor<SPIRVLowerBoolBase> {
5555
public:
5656
SPIRVLowerBoolBase() : Context(nullptr) {}
57+
virtual ~SPIRVLowerBoolBase() {}
5758
void replace(Instruction *I, Instruction *NewI) {
5859
NewI->takeName(I);
5960
I->replaceAllUsesWith(NewI);

lib/SPIRV/SPIRVLowerMemmove.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace SPIRV {
5555
class SPIRVLowerMemmoveBase : public InstVisitor<SPIRVLowerMemmoveBase> {
5656
public:
5757
SPIRVLowerMemmoveBase() : Context(nullptr) {}
58+
virtual ~SPIRVLowerMemmoveBase() {}
5859
virtual void visitMemMoveInst(MemMoveInst &I) {
5960
IRBuilder<> Builder(I.getParent());
6061
Builder.SetInsertPoint(&I);
@@ -137,7 +138,7 @@ class SPIRVLowerMemmoveLegacy : public ModulePass,
137138
SPIRVLowerMemmoveLegacy() : ModulePass(ID) {
138139
initializeSPIRVLowerMemmoveLegacyPass(*PassRegistry::getPassRegistry());
139140
}
140-
bool runOnModule(Module &M) { return runLowerMemmove(M); }
141+
bool runOnModule(Module &M) override { return runLowerMemmove(M); }
141142

142143
static char ID;
143144
};

lib/SPIRV/SPIRVLowerSPIRBlocks.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ namespace SPIRV {
9191
class SPIRVLowerSPIRBlocksBase {
9292
public:
9393
SPIRVLowerSPIRBlocksBase() : M(nullptr) {}
94+
virtual ~SPIRVLowerSPIRBlocksBase() {}
9495

9596
bool runLowerSPIRBlocks(Module &Module) {
9697
M = &Module;

lib/SPIRV/SPIRVLowerSaddWithOverflow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class SPIRVLowerSaddWithOverflowBase
6363
: public InstVisitor<SPIRVLowerSaddWithOverflowBase> {
6464
public:
6565
SPIRVLowerSaddWithOverflowBase() : Context(nullptr) {}
66+
virtual ~SPIRVLowerSaddWithOverflowBase() {}
6667
virtual void visitIntrinsicInst(CallInst &I) {
6768
IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I);
6869
if (!II || II->getIntrinsicID() != Intrinsic::sadd_with_overflow)

lib/SPIRV/SPIRVToOCL.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace SPIRV {
5050
class SPIRVToOCLBase : public InstVisitor<SPIRVToOCLBase> {
5151
public:
5252
SPIRVToOCLBase() : M(nullptr), Ctx(nullptr) {}
53+
virtual ~SPIRVToOCLBase() {}
5354

5455
virtual bool runSPIRVToOCL(Module &M) = 0;
5556

@@ -181,7 +182,7 @@ class SPIRVToOCLLegacy : public ModulePass {
181182
SPIRVToOCLLegacy(char &ID) : ModulePass(ID) {}
182183

183184
public:
184-
virtual bool runOnModule(Module &M) = 0;
185+
bool runOnModule(Module &M) override = 0;
185186
};
186187

187188
} // namespace SPIRV

0 commit comments

Comments
 (0)