Commit a19461d9 authored by Logan Smith's avatar Logan Smith
Browse files

[NFC] Add 'override' keyword where missing in include/ and lib/.

This fixes warnings raised by Clang's new -Wsuggest-override, in preparation for enabling that warning in the LLVM build. This patch also removes the virtual keyword where redundant, but only in places where doing so improves consistency within a given file. It also removes a couple unnecessary virtual destructor declarations in derived classes where the destructor inherited from the base class is already virtual.

Differential Revision: https://reviews.llvm.org/D83709
parent fbb30c31
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public:
    return isPreceededBySpecialInstruction(Insn);
  }

  virtual bool isSpecialInstruction(const Instruction *Insn) const;
  bool isSpecialInstruction(const Instruction *Insn) const override;
};

class MemoryWriteTracking : public InstructionPrecedenceTracking {
@@ -133,7 +133,7 @@ public:
    return isPreceededBySpecialInstruction(Insn);
  }

  virtual bool isSpecialInstruction(const Instruction *Insn) const;
  bool isSpecialInstruction(const Instruction *Insn) const override;
};

} // llvm
+12 −16
Original line number Diff line number Diff line
@@ -111,17 +111,15 @@ class SimpleLoopSafetyInfo: public LoopSafetyInfo {
  bool HeaderMayThrow = false; // Same as previous, but specific to loop header

public:
  virtual bool blockMayThrow(const BasicBlock *BB) const;
  bool blockMayThrow(const BasicBlock *BB) const override;

  virtual bool anyBlockMayThrow() const;
  bool anyBlockMayThrow() const override;

  virtual void computeLoopSafetyInfo(const Loop *CurLoop);
  void computeLoopSafetyInfo(const Loop *CurLoop) override;

  virtual bool isGuaranteedToExecute(const Instruction &Inst,
  bool isGuaranteedToExecute(const Instruction &Inst,
                             const DominatorTree *DT,
                                     const Loop *CurLoop) const;

  virtual ~SimpleLoopSafetyInfo() {};
                             const Loop *CurLoop) const override;
};

/// This implementation of LoopSafetyInfo use ImplicitControlFlowTracking to
@@ -138,15 +136,15 @@ class ICFLoopSafetyInfo: public LoopSafetyInfo {
  mutable MemoryWriteTracking MW;

public:
  virtual bool blockMayThrow(const BasicBlock *BB) const;
  bool blockMayThrow(const BasicBlock *BB) const override;

  virtual bool anyBlockMayThrow() const;
  bool anyBlockMayThrow() const override;

  virtual void computeLoopSafetyInfo(const Loop *CurLoop);
  void computeLoopSafetyInfo(const Loop *CurLoop) override;

  virtual bool isGuaranteedToExecute(const Instruction &Inst,
  bool isGuaranteedToExecute(const Instruction &Inst,
                             const DominatorTree *DT,
                                     const Loop *CurLoop) const;
                             const Loop *CurLoop) const override;

  /// Returns true if we could not execute a memory-modifying instruction before
  /// we enter \p BB under assumption that \p CurLoop is entered.
@@ -167,8 +165,6 @@ public:
  /// from its block. It will make all cache updates to keep it correct after
  /// this removal.
  void removeInstruction(const Instruction *Inst);

  virtual ~ICFLoopSafetyInfo() {};
};

bool mayContainIrreducibleControl(const Function &F, const LoopInfo *LI);
+6 −6
Original line number Diff line number Diff line
@@ -313,8 +313,8 @@ struct PrimitiveTypeNode : public TypeNode {
  explicit PrimitiveTypeNode(PrimitiveKind K)
      : TypeNode(NodeKind::PrimitiveType), PrimKind(K) {}

  void outputPre(OutputStream &OS, OutputFlags Flags) const;
  void outputPost(OutputStream &OS, OutputFlags Flags) const {}
  void outputPre(OutputStream &OS, OutputFlags Flags) const override;
  void outputPost(OutputStream &OS, OutputFlags Flags) const override {}

  PrimitiveKind PrimKind;
};
@@ -474,8 +474,8 @@ struct PointerTypeNode : public TypeNode {
struct TagTypeNode : public TypeNode {
  explicit TagTypeNode(TagKind Tag) : TypeNode(NodeKind::TagType), Tag(Tag) {}

  void outputPre(OutputStream &OS, OutputFlags Flags) const;
  void outputPost(OutputStream &OS, OutputFlags Flags) const;
  void outputPre(OutputStream &OS, OutputFlags Flags) const override;
  void outputPost(OutputStream &OS, OutputFlags Flags) const override;

  QualifiedNameNode *QualifiedName = nullptr;
  TagKind Tag;
@@ -484,8 +484,8 @@ struct TagTypeNode : public TypeNode {
struct ArrayTypeNode : public TypeNode {
  ArrayTypeNode() : TypeNode(NodeKind::ArrayType) {}

  void outputPre(OutputStream &OS, OutputFlags Flags) const;
  void outputPost(OutputStream &OS, OutputFlags Flags) const;
  void outputPre(OutputStream &OS, OutputFlags Flags) const override;
  void outputPost(OutputStream &OS, OutputFlags Flags) const override;

  void outputDimensionsImpl(OutputStream &OS, OutputFlags Flags) const;
  void outputOneDimension(OutputStream &OS, OutputFlags Flags, Node *N) const;
+5 −5
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ public:
};

class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
  virtual void anchor() override;
  void anchor() override;
public:
  DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize,
                          DiagnosticSeverity Severity = DS_Warning,
@@ -364,7 +364,7 @@ public:

/// Common features for diagnostics with an associated location.
class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
  virtual void anchor() override;
  void anchor() override;
public:
  /// \p Fn is the function where the diagnostic is being emitted. \p Loc is
  /// the location information to use in the diagnostic.
@@ -611,7 +611,7 @@ operator<<(RemarkT &R,
/// Common features for diagnostics dealing with optimization remarks
/// that are used by IR passes.
class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
  virtual void anchor() override;
  void anchor() override;
public:
  /// \p PassName is the name of the pass emitting this diagnostic. \p
  /// RemarkName is a textual identifier for the remark (single-word,
@@ -832,7 +832,7 @@ private:
/// Diagnostic information for optimization analysis remarks related to
/// floating-point non-commutativity.
class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
  virtual void anchor();
  void anchor() override;
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-analysis=, then the
@@ -874,7 +874,7 @@ private:
/// Diagnostic information for optimization analysis remarks related to
/// pointer aliasing.
class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
  virtual void anchor();
  void anchor() override;
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-analysis=, then the
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ protected:
public:
  virtual ~MCELFObjectTargetWriter() = default;

  virtual Triple::ObjectFormatType getFormat() const { return Triple::ELF; }
  Triple::ObjectFormatType getFormat() const override { return Triple::ELF; }
  static bool classof(const MCObjectTargetWriter *W) {
    return W->getFormat() == Triple::ELF;
  }
Loading