1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Clean up uses of gmock Invoke in an attempt to make it work with GCC 6.2. NFCI.

This commit is contained in:
Benjamin Kramer 2021-05-17 13:48:09 +02:00
parent 8655d76475
commit 1e6c6cdc2d

View File

@ -26,11 +26,7 @@ using namespace llvm;
namespace {
using testing::AnyNumber;
using testing::AtLeast;
using testing::DoAll;
using testing::DoDefault;
using testing::Expectation;
using testing::Invoke;
using testing::Not;
using testing::Return;
using testing::WithArgs;
@ -104,7 +100,7 @@ protected:
run(_, _, testing::Matcher<ExtraArgTs>(_)...))
.WillByDefault(Return(this->getResult()));
ON_CALL(static_cast<DerivedT &>(*this), invalidate(_, _, _))
.WillByDefault(Invoke(&invalidateCallback));
.WillByDefault(&invalidateCallback);
}
};
@ -528,7 +524,7 @@ using LoopCallbacksTest = PassBuilderCallbacksTest<LoopPassManager>;
TEST_F(ModuleCallbacksTest, Passes) {
EXPECT_CALL(AnalysisHandle, run(HasName("<string>"), _));
EXPECT_CALL(PassHandle, run(HasName("<string>"), _))
.WillOnce(Invoke(getAnalysisResult));
.WillOnce(&getAnalysisResult);
StringRef PipelineText = "test-transform";
ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText), Succeeded())
@ -540,7 +536,7 @@ TEST_F(ModuleCallbacksTest, Passes) {
TEST_F(ModuleCallbacksTest, InstrumentedPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("<string>"), _));
EXPECT_CALL(PassHandle, run(HasName("<string>"), _))
.WillOnce(Invoke(getAnalysisResult));
.WillOnce(&getAnalysisResult);
CallbacksHandle.registerPassInstrumentation();
// Non-mock instrumentation not specifically mentioned below can be ignored.
@ -700,8 +696,7 @@ TEST_F(ModuleCallbacksTest, InstrumentedSkippedPasses) {
TEST_F(FunctionCallbacksTest, Passes) {
EXPECT_CALL(AnalysisHandle, run(HasName("foo"), _));
EXPECT_CALL(PassHandle, run(HasName("foo"), _))
.WillOnce(Invoke(getAnalysisResult));
EXPECT_CALL(PassHandle, run(HasName("foo"), _)).WillOnce(&getAnalysisResult);
StringRef PipelineText = "test-transform";
ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText), Succeeded())
@ -716,8 +711,7 @@ TEST_F(FunctionCallbacksTest, InstrumentedPasses) {
CallbacksHandle.ignoreNonMockPassInstrumentation("foo");
EXPECT_CALL(AnalysisHandle, run(HasName("foo"), _));
EXPECT_CALL(PassHandle, run(HasName("foo"), _))
.WillOnce(Invoke(getAnalysisResult));
EXPECT_CALL(PassHandle, run(HasName("foo"), _)).WillOnce(&getAnalysisResult);
// PassInstrumentation calls should happen in-sequence, in the same order
// as passes/analyses are scheduled.
@ -808,7 +802,7 @@ TEST_F(FunctionCallbacksTest, InstrumentedSkippedPasses) {
TEST_F(LoopCallbacksTest, Passes) {
EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _));
EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _))
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
.WillOnce(WithArgs<0, 1, 2>(&getAnalysisResult));
EXPECT_CALL(ExtraPassHandle, run(HasName("loop"), _, _, _));
StringRef PipelineText = "test-transform";
@ -826,7 +820,7 @@ TEST_F(LoopCallbacksTest, InstrumentedPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _));
EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _))
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
.WillOnce(WithArgs<0, 1, 2>(&getAnalysisResult));
EXPECT_CALL(ExtraPassHandle, run(HasName("loop"), _, _, _));
// PassInstrumentation calls should happen in-sequence, in the same order
@ -891,8 +885,8 @@ TEST_F(LoopCallbacksTest, InstrumentedInvalidatingPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _));
EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _))
.WillOnce(DoAll(WithArgs<0, 1, 2, 3>(Invoke(PassHandle.invalidateLoop)),
WithArgs<0, 1, 2>(Invoke(getAnalysisResult))));
.WillOnce(DoAll(WithArgs<0, 1, 2, 3>(&PassHandle.invalidateLoop),
WithArgs<0, 1, 2>(&getAnalysisResult)));
// PassInstrumentation calls should happen in-sequence, in the same order
// as passes/analyses are scheduled.
@ -939,13 +933,12 @@ TEST_F(LoopCallbacksTest, InstrumentedInvalidatingLoopNestPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _));
EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _))
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
.WillOnce(WithArgs<0, 1, 2>(&getAnalysisResult));
EXPECT_CALL(ExtraPassHandle, run(HasName("loop"), _, _, _))
.WillOnce(DoAll(Invoke(ExtraPassHandle.invalidateLoopNest),
Invoke([&](LoopNest &, LoopAnalysisManager &,
LoopStandardAnalysisResults &, LPMUpdater &) {
return PreservedAnalyses::all();
})));
.WillOnce(DoAll(&ExtraPassHandle.invalidateLoopNest,
[&](LoopNest &, LoopAnalysisManager &,
LoopStandardAnalysisResults &,
LPMUpdater &) { return PreservedAnalyses::all(); }));
// PassInstrumentation calls should happen in-sequence, in the same order
// as passes/analyses are scheduled.
@ -1071,7 +1064,7 @@ TEST_F(LoopCallbacksTest, InstrumentedSkippedPasses) {
TEST_F(CGSCCCallbacksTest, Passes) {
EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _));
EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _))
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
.WillOnce(WithArgs<0, 1, 2>(&getAnalysisResult));
StringRef PipelineText = "test-transform";
ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText), Succeeded())
@ -1088,7 +1081,7 @@ TEST_F(CGSCCCallbacksTest, InstrumentedPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _));
EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _))
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
.WillOnce(WithArgs<0, 1, 2>(&getAnalysisResult));
// PassInstrumentation calls should happen in-sequence, in the same order
// as passes/analyses are scheduled.
@ -1139,8 +1132,8 @@ TEST_F(CGSCCCallbacksTest, InstrumentedInvalidatingPasses) {
EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _));
EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _))
.WillOnce(DoAll(WithArgs<0, 1, 2, 3>(Invoke(PassHandle.invalidateSCC)),
WithArgs<0, 1, 2>(Invoke(getAnalysisResult))));
.WillOnce(DoAll(WithArgs<0, 1, 2, 3>(&PassHandle.invalidateSCC),
WithArgs<0, 1, 2>(&getAnalysisResult)));
// PassInstrumentation calls should happen in-sequence, in the same order
// as passes/analyses are scheduled.
@ -1300,7 +1293,7 @@ TEST_F(ModuleCallbacksTest, ParseTopLevelPipeline) {
EXPECT_CALL(AnalysisHandle, run(HasName("<string>"), _));
EXPECT_CALL(PassHandle, run(HasName("<string>"), _))
.WillOnce(Invoke(getAnalysisResult));
.WillOnce(&getAnalysisResult);
EXPECT_CALL(AnalysisHandle, invalidate(HasName("<string>"), _, _));
StringRef PipelineText =