[llvm] 31eb834 - [llvm][NFC] Add missing 'override's in unittests/

Logan Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 17:37:29 PDT 2020


Author: Logan Smith
Date: 2020-07-17T17:35:59-07:00
New Revision: 31eb83496fb4e41e322e19f162aeae885ed91301

URL: https://github.com/llvm/llvm-project/commit/31eb83496fb4e41e322e19f162aeae885ed91301
DIFF: https://github.com/llvm/llvm-project/commit/31eb83496fb4e41e322e19f162aeae885ed91301.diff

LOG: [llvm][NFC] Add missing 'override's in unittests/

Added: 
    

Modified: 
    llvm/unittests/ADT/TwineTest.cpp
    llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
    llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
    llvm/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp
    llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
    llvm/unittests/IR/LegacyPassManagerTest.cpp
    llvm/unittests/IR/ModuleTest.cpp
    llvm/unittests/ProfileData/InstrProfTest.cpp
    llvm/unittests/Support/CrashRecoveryTest.cpp
    llvm/unittests/Support/ELFAttributeParserTest.cpp
    llvm/unittests/Support/FileCheckTest.cpp
    llvm/unittests/Transforms/Utils/LocalTest.cpp
    llvm/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
    llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp
    llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ADT/TwineTest.cpp b/llvm/unittests/ADT/TwineTest.cpp
index a717036c1364..52cec68210b7 100644
--- a/llvm/unittests/ADT/TwineTest.cpp
+++ b/llvm/unittests/ADT/TwineTest.cpp
@@ -105,7 +105,7 @@ TEST(TwineTest, LazyEvaluation) {
     explicit formatter(int &Count) : FormatAdapter(0), Count(Count) {}
     int &Count;
 
-    void format(raw_ostream &OS, StringRef Style) { ++Count; }
+    void format(raw_ostream &OS, StringRef Style) override { ++Count; }
   };
 
   int Count = 0;

diff  --git a/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp b/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
index 2e95465fb5ac..cbf8d47c6471 100644
--- a/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
+++ b/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
@@ -64,11 +64,11 @@ namespace {
 
 class MockCallbacks : public TypeVisitorCallbacks {
 public:
-  virtual Error visitTypeBegin(CVType &CVR, TypeIndex Index) {
+  Error visitTypeBegin(CVType &CVR, TypeIndex Index) override {
     Indices.push_back(Index);
     return Error::success();
   }
-  virtual Error visitKnownRecord(CVType &CVR, ArrayRecord &AR) {
+  Error visitKnownRecord(CVType &CVR, ArrayRecord &AR) override {
     VisitedRecords.push_back(AR);
     RawRecords.push_back(CVR);
     return Error::success();

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index f4ea34d02094..26fb8e824923 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -126,7 +126,7 @@ struct DebugLineBasicFixture : public Test, public CommonFixture {};
 struct DebugLineParameterisedFixture
     : public TestWithParam<std::pair<uint16_t, DwarfFormat>>,
       public CommonFixture {
-  void SetUp() { std::tie(Version, Format) = GetParam(); }
+  void SetUp() override { std::tie(Version, Format) = GetParam(); }
 
   uint16_t Version;
   DwarfFormat Format;
@@ -328,7 +328,7 @@ TEST_F(DebugLineBasicFixture, ErrorForReservedLength) {
 
 struct DebugLineUnsupportedVersionFixture : public TestWithParam<uint16_t>,
                                             public CommonFixture {
-  void SetUp() { Version = GetParam(); }
+  void SetUp() override { Version = GetParam(); }
 
   uint16_t Version;
 };
@@ -1384,7 +1384,7 @@ struct TruncatedPrologueFixture
     : public TestWithParam<
           std::tuple<uint64_t, uint64_t, uint16_t, DwarfFormat, StringRef>>,
       public CommonFixture {
-  void SetUp() {
+  void SetUp() override {
     std::tie(Length, ExpectedOffset, Version, Format, ExpectedErr) = GetParam();
   }
 
@@ -1554,7 +1554,7 @@ struct TruncatedStandardOpcodeFixture
     : public TestWithParam<
           std::tuple<uint64_t, uint8_t, ValueAndLengths, StringRef, StringRef>>,
       public TruncatedOpcodeFixtureBase {
-  void SetUp() {
+  void SetUp() override {
     std::tie(BodyLength, Opcode, Operands, ExpectedOutput, ExpectedErr) =
         GetParam();
   }
@@ -1564,7 +1564,7 @@ struct TruncatedExtendedOpcodeFixture
     : public TestWithParam<std::tuple<uint64_t, uint64_t, uint8_t,
                                       ValueAndLengths, StringRef, StringRef>>,
       public TruncatedOpcodeFixtureBase {
-  void SetUp() {
+  void SetUp() override {
     std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput,
              ExpectedErr) = GetParam();
   }

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
index 4df77baf9471..0a0b8084f65f 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
@@ -125,7 +125,7 @@ using ParamType = std::tuple<Form, uint16_t, uint8_t, DwarfFormat,
                              ArrayRef<uint8_t>, uint64_t, bool>;
 
 struct FormSkipValueFixtureBase : public testing::TestWithParam<ParamType> {
-  void SetUp() {
+  void SetUp() override {
     std::tie(Fm, Version, AddrSize, Dwarf, InitialData, ExpectedSkipped,
              ExpectedResult) = GetParam();
   }

diff  --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index b4e8a8302d3b..6f6e1d43af93 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -1044,7 +1044,7 @@ TEST_F(CoreAPIsStandardTest, GeneratorTest) {
     TestGenerator(SymbolMap Symbols) : Symbols(std::move(Symbols)) {}
     Error tryToGenerate(LookupKind K, JITDylib &JD,
                         JITDylibLookupFlags JDLookupFlags,
-                        const SymbolLookupSet &Names) {
+                        const SymbolLookupSet &Names) override {
       SymbolMap NewDefs;
 
       for (const auto &KV : Names) {

diff  --git a/llvm/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp
index 59cd11c5e5a6..a13d8bdeeeb3 100644
--- a/llvm/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp
@@ -17,7 +17,7 @@ namespace {
 
 class DummyTrampolinePool : public orc::TrampolinePool {
 public:
-  Expected<JITTargetAddress> getTrampoline() {
+  Expected<JITTargetAddress> getTrampoline() override {
     llvm_unreachable("Unimplemented");
   }
 };

diff  --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index 4a192c1f28ac..c9c15aa3dffd 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -117,7 +117,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
   public:
     FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
 
-    Expected<CompileResult> operator()(Module &M) {
+    Expected<CompileResult> operator()(Module &M) override {
       auto *Foo = M.getFunction("foo");
       assert(Foo && "Expected function Foo not found");
       Foo->setVisibility(GlobalValue::HiddenVisibility);
@@ -187,7 +187,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
   public:
     FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
 
-    Expected<CompileResult> operator()(Module &M) {
+    Expected<CompileResult> operator()(Module &M) override {
       Function *BarImpl = Function::Create(
           FunctionType::get(Type::getVoidTy(M.getContext()), {}, false),
           GlobalValue::ExternalLinkage, "bar", &M);

diff  --git a/llvm/unittests/IR/LegacyPassManagerTest.cpp b/llvm/unittests/IR/LegacyPassManagerTest.cpp
index 8dda94b1b032..72ac4be22997 100644
--- a/llvm/unittests/IR/LegacyPassManagerTest.cpp
+++ b/llvm/unittests/IR/LegacyPassManagerTest.cpp
@@ -355,12 +355,12 @@ namespace llvm {
     struct CustomOptPassGate : public OptPassGate {
       bool Skip;
       CustomOptPassGate(bool Skip) : Skip(Skip) { }
-      bool shouldRunPass(const Pass *P, StringRef IRDescription) {
+      bool shouldRunPass(const Pass *P, StringRef IRDescription) override {
         if (P->getPassKind() == PT_Module)
           return !Skip;
         return OptPassGate::shouldRunPass(P, IRDescription);
       }
-      bool isEnabled() const { return true; }
+      bool isEnabled() const override { return true; }
     };
 
     // Optional module pass.

diff  --git a/llvm/unittests/IR/ModuleTest.cpp b/llvm/unittests/IR/ModuleTest.cpp
index 9fb9b8b057a5..4e2e394a9250 100644
--- a/llvm/unittests/IR/ModuleTest.cpp
+++ b/llvm/unittests/IR/ModuleTest.cpp
@@ -56,7 +56,7 @@ TEST(ModuleTest, randomNumberGenerator) {
   static char ID;
   struct DummyPass : ModulePass {
     DummyPass() : ModulePass(ID) {}
-    bool runOnModule(Module &) { return true; }
+    bool runOnModule(Module &) override { return true; }
   } DP;
 
   Module M("R", Context);

diff  --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index 3e862aafcf05..d94906991b0c 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -39,7 +39,7 @@ struct InstrProfTest : ::testing::Test {
   InstrProfWriter Writer;
   std::unique_ptr<IndexedInstrProfReader> Reader;
 
-  void SetUp() { Writer.setOutputSparse(false); }
+  void SetUp() override { Writer.setOutputSparse(false); }
 
   void readProfile(std::unique_ptr<MemoryBuffer> Profile,
                    std::unique_ptr<MemoryBuffer> Remapping = nullptr) {
@@ -51,12 +51,12 @@ struct InstrProfTest : ::testing::Test {
 };
 
 struct SparseInstrProfTest : public InstrProfTest {
-  void SetUp() { Writer.setOutputSparse(true); }
+  void SetUp() override { Writer.setOutputSparse(true); }
 };
 
 struct MaybeSparseInstrProfTest : public InstrProfTest,
                                   public ::testing::WithParamInterface<bool> {
-  void SetUp() { Writer.setOutputSparse(GetParam()); }
+  void SetUp() override { Writer.setOutputSparse(GetParam()); }
 };
 
 TEST_P(MaybeSparseInstrProfTest, write_and_read_empty_profile) {

diff  --git a/llvm/unittests/Support/CrashRecoveryTest.cpp b/llvm/unittests/Support/CrashRecoveryTest.cpp
index 798ed20145d8..6a62c7cab9d8 100644
--- a/llvm/unittests/Support/CrashRecoveryTest.cpp
+++ b/llvm/unittests/Support/CrashRecoveryTest.cpp
@@ -39,7 +39,7 @@ TEST(CrashRecoveryTest, Basic) {
 struct IncrementGlobalCleanup : CrashRecoveryContextCleanup {
   IncrementGlobalCleanup(CrashRecoveryContext *CRC)
       : CrashRecoveryContextCleanup(CRC) {}
-  virtual void recoverResources() { ++GlobalInt; }
+  void recoverResources() override { ++GlobalInt; }
 };
 
 static void noop() {}

diff  --git a/llvm/unittests/Support/ELFAttributeParserTest.cpp b/llvm/unittests/Support/ELFAttributeParserTest.cpp
index 8234d4ee176f..5eaed39a7105 100644
--- a/llvm/unittests/Support/ELFAttributeParserTest.cpp
+++ b/llvm/unittests/Support/ELFAttributeParserTest.cpp
@@ -17,7 +17,7 @@ static const TagNameMap emptyTagNameMap;
 
 // This class is used to test the common part of the ELF attribute section.
 class AttributeHeaderParser : public ELFAttributeParser {
-  Error handler(uint64_t tag, bool &handled) {
+  Error handler(uint64_t tag, bool &handled) override {
     // Treat all attributes as handled.
     handled = true;
     return Error::success();

diff  --git a/llvm/unittests/Support/FileCheckTest.cpp b/llvm/unittests/Support/FileCheckTest.cpp
index 92975dcd76b7..8cf823425fc3 100644
--- a/llvm/unittests/Support/FileCheckTest.cpp
+++ b/llvm/unittests/Support/FileCheckTest.cpp
@@ -104,7 +104,7 @@ struct ExpressionFormatParameterisedFixture
 
   SourceMgr SM;
 
-  void SetUp() {
+  void SetUp() override {
     ExpressionFormat::Kind Kind = GetParam();
     AllowHex = Kind == ExpressionFormat::Kind::HexLower ||
                Kind == ExpressionFormat::Kind::HexUpper;

diff  --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp
index 3862a418603b..3dec930a2727 100644
--- a/llvm/unittests/Transforms/Utils/LocalTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp
@@ -489,7 +489,7 @@ struct SalvageDebugInfoTest : ::testing::Test {
   std::unique_ptr<Module> M;
   Function *F = nullptr;
 
-  void SetUp() {
+  void SetUp() override {
     M = parseIR(C,
                 R"(
       define void @f() !dbg !8 {

diff  --git a/llvm/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp b/llvm/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
index ef53a70aeea0..6bb083b4d2bf 100644
--- a/llvm/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
+++ b/llvm/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp
@@ -65,7 +65,7 @@ class BasicFileAnalysisTest : public ::testing::Test {
   BasicFileAnalysisTest(StringRef Trip)
       : SuccessfullyInitialised(false), Analysis(Trip) {}
 protected:
-  virtual void SetUp() {
+  void SetUp() override {
     IgnoreDWARFFlag = true;
     SuccessfullyInitialised = true;
     if (auto Err = Analysis.initialiseDisassemblyMembers()) {

diff  --git a/llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp b/llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp
index a57958d60e68..954c113b915e 100644
--- a/llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp
+++ b/llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp
@@ -124,7 +124,7 @@ class ELFx86TestFileAnalysis : public FileAnalysis {
 
 class BasicGraphBuilderTest : public ::testing::Test {
 protected:
-  virtual void SetUp() {
+  void SetUp() override {
     IgnoreDWARFFlag = true;
     SuccessfullyInitialised = true;
     if (auto Err = Analysis.initialiseDisassemblyMembers()) {

diff  --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
index 298a54abffc8..dcc9617065b0 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
@@ -29,7 +29,7 @@ using testing::UnorderedElementsAre;
 
 class X86SnippetRepetitorTest : public X86TestBase {
 protected:
-  void SetUp() {
+  void SetUp() override {
     TM = State.createTargetMachine();
     Context = std::make_unique<LLVMContext>();
     Mod = std::make_unique<Module>("X86SnippetRepetitorTest", *Context);


        


More information about the llvm-commits mailing list