From 951866abd5dda022c2fbab844c141963b02ad240 Mon Sep 17 00:00:00 2001 From: Logan Smith Date: Thu, 16 Jul 2020 20:36:46 -0700 Subject: [PATCH] [llvm][NFC] Add missing 'override's in unittests/ --- unittests/ADT/TwineTest.cpp | 2 +- .../DebugInfo/CodeView/RandomAccessVisitorTest.cpp | 4 ++-- unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 10 +++++----- unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp | 2 +- unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp | 2 +- .../Orc/LegacyCompileOnDemandLayerTest.cpp | 2 +- .../Orc/RTDyldObjectLinkingLayerTest.cpp | 4 ++-- unittests/IR/LegacyPassManagerTest.cpp | 4 ++-- unittests/IR/ModuleTest.cpp | 2 +- unittests/ProfileData/InstrProfTest.cpp | 6 +++--- unittests/Support/CrashRecoveryTest.cpp | 2 +- unittests/Support/ELFAttributeParserTest.cpp | 2 +- unittests/Support/FileCheckTest.cpp | 2 +- unittests/Transforms/Utils/LocalTest.cpp | 2 +- unittests/tools/llvm-cfi-verify/FileAnalysis.cpp | 2 +- unittests/tools/llvm-cfi-verify/GraphBuilder.cpp | 2 +- .../tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp | 2 +- 17 files changed, 26 insertions(+), 26 deletions(-) diff --git a/unittests/ADT/TwineTest.cpp b/unittests/ADT/TwineTest.cpp index a717036c136..52cec68210b 100644 --- a/unittests/ADT/TwineTest.cpp +++ b/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/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp b/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp index 2e95465fb5a..cbf8d47c647 100644 --- a/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp +++ b/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/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index f4ea34d0209..26fb8e82492 100644 --- a/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -126,7 +126,7 @@ struct DebugLineBasicFixture : public Test, public CommonFixture {}; struct DebugLineParameterisedFixture : public TestWithParam>, 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, public CommonFixture { - void SetUp() { Version = GetParam(); } + void SetUp() override { Version = GetParam(); } uint16_t Version; }; @@ -1384,7 +1384,7 @@ struct TruncatedPrologueFixture : public TestWithParam< std::tuple>, 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>, public TruncatedOpcodeFixtureBase { - void SetUp() { + void SetUp() override { std::tie(BodyLength, Opcode, Operands, ExpectedOutput, ExpectedErr) = GetParam(); } @@ -1564,7 +1564,7 @@ struct TruncatedExtendedOpcodeFixture : public TestWithParam>, public TruncatedOpcodeFixtureBase { - void SetUp() { + void SetUp() override { std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput, ExpectedErr) = GetParam(); } diff --git a/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp b/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp index 4df77baf947..0a0b8084f65 100644 --- a/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp +++ b/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp @@ -125,7 +125,7 @@ using ParamType = std::tuple, uint64_t, bool>; struct FormSkipValueFixtureBase : public testing::TestWithParam { - void SetUp() { + void SetUp() override { std::tie(Fm, Version, AddrSize, Dwarf, InitialData, ExpectedSkipped, ExpectedResult) = GetParam(); } diff --git a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index b4e8a8302d3..6f6e1d43af9 100644 --- a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/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/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp b/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp index 59cd11c5e5a..a13d8bdeeeb 100644 --- a/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp +++ b/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp @@ -17,7 +17,7 @@ namespace { class DummyTrampolinePool : public orc::TrampolinePool { public: - Expected getTrampoline() { + Expected getTrampoline() override { llvm_unreachable("Unimplemented"); } }; diff --git a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp index 4a192c1f28a..c9c15aa3dff 100644 --- a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp +++ b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp @@ -117,7 +117,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) { public: FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {} - Expected operator()(Module &M) { + Expected 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 operator()(Module &M) { + Expected operator()(Module &M) override { Function *BarImpl = Function::Create( FunctionType::get(Type::getVoidTy(M.getContext()), {}, false), GlobalValue::ExternalLinkage, "bar", &M); diff --git a/unittests/IR/LegacyPassManagerTest.cpp b/unittests/IR/LegacyPassManagerTest.cpp index 8dda94b1b03..72ac4be2299 100644 --- a/unittests/IR/LegacyPassManagerTest.cpp +++ b/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/unittests/IR/ModuleTest.cpp b/unittests/IR/ModuleTest.cpp index 9fb9b8b057a..4e2e394a925 100644 --- a/unittests/IR/ModuleTest.cpp +++ b/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/unittests/ProfileData/InstrProfTest.cpp b/unittests/ProfileData/InstrProfTest.cpp index 3e862aafcf0..d94906991b0 100644 --- a/unittests/ProfileData/InstrProfTest.cpp +++ b/unittests/ProfileData/InstrProfTest.cpp @@ -39,7 +39,7 @@ struct InstrProfTest : ::testing::Test { InstrProfWriter Writer; std::unique_ptr Reader; - void SetUp() { Writer.setOutputSparse(false); } + void SetUp() override { Writer.setOutputSparse(false); } void readProfile(std::unique_ptr Profile, std::unique_ptr 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 { - void SetUp() { Writer.setOutputSparse(GetParam()); } + void SetUp() override { Writer.setOutputSparse(GetParam()); } }; TEST_P(MaybeSparseInstrProfTest, write_and_read_empty_profile) { diff --git a/unittests/Support/CrashRecoveryTest.cpp b/unittests/Support/CrashRecoveryTest.cpp index 798ed20145d..6a62c7cab9d 100644 --- a/unittests/Support/CrashRecoveryTest.cpp +++ b/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/unittests/Support/ELFAttributeParserTest.cpp b/unittests/Support/ELFAttributeParserTest.cpp index 8234d4ee176..5eaed39a710 100644 --- a/unittests/Support/ELFAttributeParserTest.cpp +++ b/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/unittests/Support/FileCheckTest.cpp b/unittests/Support/FileCheckTest.cpp index 92975dcd76b..8cf823425fc 100644 --- a/unittests/Support/FileCheckTest.cpp +++ b/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/unittests/Transforms/Utils/LocalTest.cpp b/unittests/Transforms/Utils/LocalTest.cpp index 3862a418603..3dec930a272 100644 --- a/unittests/Transforms/Utils/LocalTest.cpp +++ b/unittests/Transforms/Utils/LocalTest.cpp @@ -489,7 +489,7 @@ struct SalvageDebugInfoTest : ::testing::Test { std::unique_ptr M; Function *F = nullptr; - void SetUp() { + void SetUp() override { M = parseIR(C, R"( define void @f() !dbg !8 { diff --git a/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp b/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp index ef53a70aeea..6bb083b4d2b 100644 --- a/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp +++ b/unittests/tools/llvm-cfi-verify/FileAnalysis.cpp @@ -65,7 +65,7 @@ public: 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/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp b/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp index a57958d60e6..954c113b915 100644 --- a/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp +++ b/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp @@ -124,7 +124,7 @@ public: class BasicGraphBuilderTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { IgnoreDWARFFlag = true; SuccessfullyInitialised = true; if (auto Err = Analysis.initialiseDisassemblyMembers()) { diff --git a/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp b/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp index 298a54abffc..dcc9617065b 100644 --- a/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp +++ b/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(); Mod = std::make_unique("X86SnippetRepetitorTest", *Context);