1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

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

This commit is contained in:
Logan Smith 2020-07-16 20:36:46 -07:00
parent 9627b7997d
commit 951866abd5
17 changed files with 26 additions and 26 deletions

View File

@ -105,7 +105,7 @@ TEST(TwineTest, LazyEvaluation) {
explicit formatter(int &Count) : FormatAdapter(0), Count(Count) {} explicit formatter(int &Count) : FormatAdapter(0), Count(Count) {}
int &Count; int &Count;
void format(raw_ostream &OS, StringRef Style) { ++Count; } void format(raw_ostream &OS, StringRef Style) override { ++Count; }
}; };
int Count = 0; int Count = 0;

View File

@ -64,11 +64,11 @@ namespace {
class MockCallbacks : public TypeVisitorCallbacks { class MockCallbacks : public TypeVisitorCallbacks {
public: public:
virtual Error visitTypeBegin(CVType &CVR, TypeIndex Index) { Error visitTypeBegin(CVType &CVR, TypeIndex Index) override {
Indices.push_back(Index); Indices.push_back(Index);
return Error::success(); return Error::success();
} }
virtual Error visitKnownRecord(CVType &CVR, ArrayRecord &AR) { Error visitKnownRecord(CVType &CVR, ArrayRecord &AR) override {
VisitedRecords.push_back(AR); VisitedRecords.push_back(AR);
RawRecords.push_back(CVR); RawRecords.push_back(CVR);
return Error::success(); return Error::success();

View File

@ -126,7 +126,7 @@ struct DebugLineBasicFixture : public Test, public CommonFixture {};
struct DebugLineParameterisedFixture struct DebugLineParameterisedFixture
: public TestWithParam<std::pair<uint16_t, DwarfFormat>>, : public TestWithParam<std::pair<uint16_t, DwarfFormat>>,
public CommonFixture { public CommonFixture {
void SetUp() { std::tie(Version, Format) = GetParam(); } void SetUp() override { std::tie(Version, Format) = GetParam(); }
uint16_t Version; uint16_t Version;
DwarfFormat Format; DwarfFormat Format;
@ -328,7 +328,7 @@ TEST_F(DebugLineBasicFixture, ErrorForReservedLength) {
struct DebugLineUnsupportedVersionFixture : public TestWithParam<uint16_t>, struct DebugLineUnsupportedVersionFixture : public TestWithParam<uint16_t>,
public CommonFixture { public CommonFixture {
void SetUp() { Version = GetParam(); } void SetUp() override { Version = GetParam(); }
uint16_t Version; uint16_t Version;
}; };
@ -1384,7 +1384,7 @@ struct TruncatedPrologueFixture
: public TestWithParam< : public TestWithParam<
std::tuple<uint64_t, uint64_t, uint16_t, DwarfFormat, StringRef>>, std::tuple<uint64_t, uint64_t, uint16_t, DwarfFormat, StringRef>>,
public CommonFixture { public CommonFixture {
void SetUp() { void SetUp() override {
std::tie(Length, ExpectedOffset, Version, Format, ExpectedErr) = GetParam(); std::tie(Length, ExpectedOffset, Version, Format, ExpectedErr) = GetParam();
} }
@ -1554,7 +1554,7 @@ struct TruncatedStandardOpcodeFixture
: public TestWithParam< : public TestWithParam<
std::tuple<uint64_t, uint8_t, ValueAndLengths, StringRef, StringRef>>, std::tuple<uint64_t, uint8_t, ValueAndLengths, StringRef, StringRef>>,
public TruncatedOpcodeFixtureBase { public TruncatedOpcodeFixtureBase {
void SetUp() { void SetUp() override {
std::tie(BodyLength, Opcode, Operands, ExpectedOutput, ExpectedErr) = std::tie(BodyLength, Opcode, Operands, ExpectedOutput, ExpectedErr) =
GetParam(); GetParam();
} }
@ -1564,7 +1564,7 @@ struct TruncatedExtendedOpcodeFixture
: public TestWithParam<std::tuple<uint64_t, uint64_t, uint8_t, : public TestWithParam<std::tuple<uint64_t, uint64_t, uint8_t,
ValueAndLengths, StringRef, StringRef>>, ValueAndLengths, StringRef, StringRef>>,
public TruncatedOpcodeFixtureBase { public TruncatedOpcodeFixtureBase {
void SetUp() { void SetUp() override {
std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput, std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput,
ExpectedErr) = GetParam(); ExpectedErr) = GetParam();
} }

View File

@ -125,7 +125,7 @@ using ParamType = std::tuple<Form, uint16_t, uint8_t, DwarfFormat,
ArrayRef<uint8_t>, uint64_t, bool>; ArrayRef<uint8_t>, uint64_t, bool>;
struct FormSkipValueFixtureBase : public testing::TestWithParam<ParamType> { struct FormSkipValueFixtureBase : public testing::TestWithParam<ParamType> {
void SetUp() { void SetUp() override {
std::tie(Fm, Version, AddrSize, Dwarf, InitialData, ExpectedSkipped, std::tie(Fm, Version, AddrSize, Dwarf, InitialData, ExpectedSkipped,
ExpectedResult) = GetParam(); ExpectedResult) = GetParam();
} }

View File

@ -1044,7 +1044,7 @@ TEST_F(CoreAPIsStandardTest, GeneratorTest) {
TestGenerator(SymbolMap Symbols) : Symbols(std::move(Symbols)) {} TestGenerator(SymbolMap Symbols) : Symbols(std::move(Symbols)) {}
Error tryToGenerate(LookupKind K, JITDylib &JD, Error tryToGenerate(LookupKind K, JITDylib &JD,
JITDylibLookupFlags JDLookupFlags, JITDylibLookupFlags JDLookupFlags,
const SymbolLookupSet &Names) { const SymbolLookupSet &Names) override {
SymbolMap NewDefs; SymbolMap NewDefs;
for (const auto &KV : Names) { for (const auto &KV : Names) {

View File

@ -17,7 +17,7 @@ namespace {
class DummyTrampolinePool : public orc::TrampolinePool { class DummyTrampolinePool : public orc::TrampolinePool {
public: public:
Expected<JITTargetAddress> getTrampoline() { Expected<JITTargetAddress> getTrampoline() override {
llvm_unreachable("Unimplemented"); llvm_unreachable("Unimplemented");
} }
}; };

View File

@ -117,7 +117,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
public: public:
FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {} FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
Expected<CompileResult> operator()(Module &M) { Expected<CompileResult> operator()(Module &M) override {
auto *Foo = M.getFunction("foo"); auto *Foo = M.getFunction("foo");
assert(Foo && "Expected function Foo not found"); assert(Foo && "Expected function Foo not found");
Foo->setVisibility(GlobalValue::HiddenVisibility); Foo->setVisibility(GlobalValue::HiddenVisibility);
@ -187,7 +187,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
public: public:
FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {} FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
Expected<CompileResult> operator()(Module &M) { Expected<CompileResult> operator()(Module &M) override {
Function *BarImpl = Function::Create( Function *BarImpl = Function::Create(
FunctionType::get(Type::getVoidTy(M.getContext()), {}, false), FunctionType::get(Type::getVoidTy(M.getContext()), {}, false),
GlobalValue::ExternalLinkage, "bar", &M); GlobalValue::ExternalLinkage, "bar", &M);

View File

@ -355,12 +355,12 @@ namespace llvm {
struct CustomOptPassGate : public OptPassGate { struct CustomOptPassGate : public OptPassGate {
bool Skip; bool Skip;
CustomOptPassGate(bool Skip) : Skip(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) if (P->getPassKind() == PT_Module)
return !Skip; return !Skip;
return OptPassGate::shouldRunPass(P, IRDescription); return OptPassGate::shouldRunPass(P, IRDescription);
} }
bool isEnabled() const { return true; } bool isEnabled() const override { return true; }
}; };
// Optional module pass. // Optional module pass.

View File

@ -56,7 +56,7 @@ TEST(ModuleTest, randomNumberGenerator) {
static char ID; static char ID;
struct DummyPass : ModulePass { struct DummyPass : ModulePass {
DummyPass() : ModulePass(ID) {} DummyPass() : ModulePass(ID) {}
bool runOnModule(Module &) { return true; } bool runOnModule(Module &) override { return true; }
} DP; } DP;
Module M("R", Context); Module M("R", Context);

View File

@ -39,7 +39,7 @@ struct InstrProfTest : ::testing::Test {
InstrProfWriter Writer; InstrProfWriter Writer;
std::unique_ptr<IndexedInstrProfReader> Reader; std::unique_ptr<IndexedInstrProfReader> Reader;
void SetUp() { Writer.setOutputSparse(false); } void SetUp() override { Writer.setOutputSparse(false); }
void readProfile(std::unique_ptr<MemoryBuffer> Profile, void readProfile(std::unique_ptr<MemoryBuffer> Profile,
std::unique_ptr<MemoryBuffer> Remapping = nullptr) { std::unique_ptr<MemoryBuffer> Remapping = nullptr) {
@ -51,12 +51,12 @@ struct InstrProfTest : ::testing::Test {
}; };
struct SparseInstrProfTest : public InstrProfTest { struct SparseInstrProfTest : public InstrProfTest {
void SetUp() { Writer.setOutputSparse(true); } void SetUp() override { Writer.setOutputSparse(true); }
}; };
struct MaybeSparseInstrProfTest : public InstrProfTest, struct MaybeSparseInstrProfTest : public InstrProfTest,
public ::testing::WithParamInterface<bool> { public ::testing::WithParamInterface<bool> {
void SetUp() { Writer.setOutputSparse(GetParam()); } void SetUp() override { Writer.setOutputSparse(GetParam()); }
}; };
TEST_P(MaybeSparseInstrProfTest, write_and_read_empty_profile) { TEST_P(MaybeSparseInstrProfTest, write_and_read_empty_profile) {

View File

@ -39,7 +39,7 @@ TEST(CrashRecoveryTest, Basic) {
struct IncrementGlobalCleanup : CrashRecoveryContextCleanup { struct IncrementGlobalCleanup : CrashRecoveryContextCleanup {
IncrementGlobalCleanup(CrashRecoveryContext *CRC) IncrementGlobalCleanup(CrashRecoveryContext *CRC)
: CrashRecoveryContextCleanup(CRC) {} : CrashRecoveryContextCleanup(CRC) {}
virtual void recoverResources() { ++GlobalInt; } void recoverResources() override { ++GlobalInt; }
}; };
static void noop() {} static void noop() {}

View File

@ -17,7 +17,7 @@ static const TagNameMap emptyTagNameMap;
// This class is used to test the common part of the ELF attribute section. // This class is used to test the common part of the ELF attribute section.
class AttributeHeaderParser : public ELFAttributeParser { class AttributeHeaderParser : public ELFAttributeParser {
Error handler(uint64_t tag, bool &handled) { Error handler(uint64_t tag, bool &handled) override {
// Treat all attributes as handled. // Treat all attributes as handled.
handled = true; handled = true;
return Error::success(); return Error::success();

View File

@ -104,7 +104,7 @@ struct ExpressionFormatParameterisedFixture
SourceMgr SM; SourceMgr SM;
void SetUp() { void SetUp() override {
ExpressionFormat::Kind Kind = GetParam(); ExpressionFormat::Kind Kind = GetParam();
AllowHex = Kind == ExpressionFormat::Kind::HexLower || AllowHex = Kind == ExpressionFormat::Kind::HexLower ||
Kind == ExpressionFormat::Kind::HexUpper; Kind == ExpressionFormat::Kind::HexUpper;

View File

@ -489,7 +489,7 @@ struct SalvageDebugInfoTest : ::testing::Test {
std::unique_ptr<Module> M; std::unique_ptr<Module> M;
Function *F = nullptr; Function *F = nullptr;
void SetUp() { void SetUp() override {
M = parseIR(C, M = parseIR(C,
R"( R"(
define void @f() !dbg !8 { define void @f() !dbg !8 {

View File

@ -65,7 +65,7 @@ public:
BasicFileAnalysisTest(StringRef Trip) BasicFileAnalysisTest(StringRef Trip)
: SuccessfullyInitialised(false), Analysis(Trip) {} : SuccessfullyInitialised(false), Analysis(Trip) {}
protected: protected:
virtual void SetUp() { void SetUp() override {
IgnoreDWARFFlag = true; IgnoreDWARFFlag = true;
SuccessfullyInitialised = true; SuccessfullyInitialised = true;
if (auto Err = Analysis.initialiseDisassemblyMembers()) { if (auto Err = Analysis.initialiseDisassemblyMembers()) {

View File

@ -124,7 +124,7 @@ public:
class BasicGraphBuilderTest : public ::testing::Test { class BasicGraphBuilderTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
IgnoreDWARFFlag = true; IgnoreDWARFFlag = true;
SuccessfullyInitialised = true; SuccessfullyInitialised = true;
if (auto Err = Analysis.initialiseDisassemblyMembers()) { if (auto Err = Analysis.initialiseDisassemblyMembers()) {

View File

@ -29,7 +29,7 @@ using testing::UnorderedElementsAre;
class X86SnippetRepetitorTest : public X86TestBase { class X86SnippetRepetitorTest : public X86TestBase {
protected: protected:
void SetUp() { void SetUp() override {
TM = State.createTargetMachine(); TM = State.createTargetMachine();
Context = std::make_unique<LLVMContext>(); Context = std::make_unique<LLVMContext>();
Mod = std::make_unique<Module>("X86SnippetRepetitorTest", *Context); Mod = std::make_unique<Module>("X86SnippetRepetitorTest", *Context);