Skip to content

Commit 6bee6b2

Browse files
[CodeGen] Add "override" where appropriate (NFC) (#164571)
Note that "override" makes "virtual" redundant. Identified with modernize-use-override.
1 parent d5a2047 commit 6bee6b2

23 files changed

+47
-48
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
366366
protected:
367367
explicit BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
368368
: BaseT(DL) {}
369-
virtual ~BasicTTIImplBase() = default;
369+
~BasicTTIImplBase() override = default;
370370

371371
using TargetTransformInfoImplBase::DL;
372372

@@ -821,13 +821,13 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
821821
SimplifyAndSetOp);
822822
}
823823

824-
virtual std::optional<unsigned>
824+
std::optional<unsigned>
825825
getCacheSize(TargetTransformInfo::CacheLevel Level) const override {
826826
return std::optional<unsigned>(
827827
getST()->getCacheSize(static_cast<unsigned>(Level)));
828828
}
829829

830-
virtual std::optional<unsigned>
830+
std::optional<unsigned>
831831
getCacheAssociativity(TargetTransformInfo::CacheLevel Level) const override {
832832
std::optional<unsigned> TargetResult =
833833
getST()->getCacheAssociativity(static_cast<unsigned>(Level));
@@ -838,31 +838,31 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
838838
return BaseT::getCacheAssociativity(Level);
839839
}
840840

841-
virtual unsigned getCacheLineSize() const override {
841+
unsigned getCacheLineSize() const override {
842842
return getST()->getCacheLineSize();
843843
}
844844

845-
virtual unsigned getPrefetchDistance() const override {
845+
unsigned getPrefetchDistance() const override {
846846
return getST()->getPrefetchDistance();
847847
}
848848

849-
virtual unsigned getMinPrefetchStride(unsigned NumMemAccesses,
850-
unsigned NumStridedMemAccesses,
851-
unsigned NumPrefetches,
852-
bool HasCall) const override {
849+
unsigned getMinPrefetchStride(unsigned NumMemAccesses,
850+
unsigned NumStridedMemAccesses,
851+
unsigned NumPrefetches,
852+
bool HasCall) const override {
853853
return getST()->getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
854854
NumPrefetches, HasCall);
855855
}
856856

857-
virtual unsigned getMaxPrefetchIterationsAhead() const override {
857+
unsigned getMaxPrefetchIterationsAhead() const override {
858858
return getST()->getMaxPrefetchIterationsAhead();
859859
}
860860

861-
virtual bool enableWritePrefetching() const override {
861+
bool enableWritePrefetching() const override {
862862
return getST()->enableWritePrefetching();
863863
}
864864

865-
virtual bool shouldPrefetchAddressSpace(unsigned AS) const override {
865+
bool shouldPrefetchAddressSpace(unsigned AS) const override {
866866
return getST()->shouldPrefetchAddressSpace(AS);
867867
}
868868

llvm/include/llvm/CodeGen/CodeGenTargetMachineImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class LLVM_ABI CodeGenTargetMachineImpl : public TargetMachine {
4242

4343
/// Create a pass configuration object to be used by addPassToEmitX methods
4444
/// for generating a pipeline of CodeGen passes.
45-
virtual TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
45+
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
4646

4747
/// Add passes to the specified pass manager to get the specified file
4848
/// emitted. Typically this will involve several steps of code generation.

llvm/include/llvm/CodeGen/DebugHandlerBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class DebugHandlerBase : public AsmPrinterHandler {
118118

119119
// AsmPrinterHandler overrides.
120120
public:
121-
virtual ~DebugHandlerBase() override;
121+
~DebugHandlerBase() override;
122122

123123
void beginModule(Module *M) override;
124124

llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ class LLVM_ABI DroppedVariableStatsMIR : public DroppedVariableStats {
4444
StringRef FuncOrModName);
4545
/// Override base class method to run on an llvm::MachineFunction
4646
/// specifically.
47-
virtual void
48-
visitEveryInstruction(unsigned &DroppedCount,
49-
DenseMap<VarID, DILocation *> &InlinedAtsMap,
50-
VarID Var) override;
47+
void visitEveryInstruction(unsigned &DroppedCount,
48+
DenseMap<VarID, DILocation *> &InlinedAtsMap,
49+
VarID Var) override;
5150
/// Override base class method to run on DBG_VALUEs specifically.
52-
virtual void visitEveryDebugRecord(
51+
void visitEveryDebugRecord(
5352
DenseSet<VarID> &VarIDSet,
5453
DenseMap<StringRef, DenseMap<VarID, DILocation *>> &InlinedAtsMap,
5554
StringRef FuncName, bool Before) override;

llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ class UniqueMachineInstr : public FoldingSetNode {
4040
// A CSE config for fully optimized builds.
4141
class LLVM_ABI CSEConfigFull : public CSEConfigBase {
4242
public:
43-
virtual ~CSEConfigFull() = default;
43+
~CSEConfigFull() override = default;
4444
bool shouldCSEOpc(unsigned Opc) override;
4545
};
4646

4747
// Commonly used for O0 config.
4848
class LLVM_ABI CSEConfigConstantOnly : public CSEConfigBase {
4949
public:
50-
virtual ~CSEConfigConstantOnly() = default;
50+
~CSEConfigConstantOnly() override = default;
5151
bool shouldCSEOpc(unsigned Opc) override;
5252
};
5353

@@ -118,7 +118,7 @@ class LLVM_ABI GISelCSEInfo : public GISelChangeObserver {
118118
public:
119119
GISelCSEInfo() = default;
120120

121-
virtual ~GISelCSEInfo();
121+
~GISelCSEInfo() override;
122122

123123
void setMF(MachineFunction &MF);
124124

llvm/include/llvm/CodeGen/GlobalISel/Combiner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Combiner : public GIMatchTableExecutor {
6060
Combiner(MachineFunction &MF, CombinerInfo &CInfo,
6161
const TargetPassConfig *TPC, GISelValueTracking *VT,
6262
GISelCSEInfo *CSEInfo = nullptr);
63-
virtual ~Combiner();
63+
~Combiner() override;
6464

6565
virtual bool tryCombineAll(MachineInstr &I) const = 0;
6666

llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class LLVM_ABI GISelValueTracking : public GISelChangeObserver {
5858

5959
public:
6060
GISelValueTracking(MachineFunction &MF, unsigned MaxDepth = 6);
61-
~GISelValueTracking() = default;
61+
~GISelValueTracking() override = default;
6262

6363
const MachineFunction &getMachineFunction() const { return MF; }
6464

llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ class IRTranslator : public MachineFunctionPass {
656656
IRT->addSuccessorWithProb(Src, Dst, Prob);
657657
}
658658

659-
virtual ~GISelSwitchLowering() = default;
659+
~GISelSwitchLowering() override = default;
660660

661661
private:
662662
IRTranslator *IRT;

llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GISelObserverWrapper;
2121

2222
class LLVM_ABI InstructionSelector : public GIMatchTableExecutor {
2323
public:
24-
virtual ~InstructionSelector();
24+
~InstructionSelector() override;
2525

2626
/// Select the (possibly generic) instruction \p I to only use target-specific
2727
/// opcodes. It is OK to insert multiple instructions, but they cannot be

llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LLVM_ABI MachineModuleSlotTracker : public ModuleSlotTracker {
3737
MachineModuleSlotTracker(const MachineModuleInfo &MMI,
3838
const MachineFunction *MF,
3939
bool ShouldInitializeAllMetadata = true);
40-
~MachineModuleSlotTracker();
40+
~MachineModuleSlotTracker() override;
4141

4242
void collectMachineMDNodes(MachineMDNodeListType &L) const;
4343
};

0 commit comments

Comments
 (0)