Googletest export

Stop using ADL for InvokeArgument action.

PiperOrigin-RevId: 323234396
This commit is contained in:
ofats 2020-07-26 08:05:02 -04:00 committed by Mark Barolak
parent a781fe29bc
commit c64309924d
4 changed files with 24 additions and 59 deletions

View File

@ -423,7 +423,7 @@ messages, you can use:
<!-- GOOGLETEST_CM0026 DO NOT DELETE -->
<!-- GOOGLETEST_CM0027 DO NOT DELETE -->
<!--#include file="includes/g3_util_status_matcher.md"-->
### Multi-argument Matchers {#MultiArgMatchers}

View File

@ -1388,23 +1388,15 @@ class ActionImpl<Derived<Ts...>> {
std::tuple<Ts...> params_;
};
namespace invoke_argument {
// Appears in InvokeArgumentAdl's argument list to help avoid
// accidental calls to user functions of the same name.
struct AdlTag {};
// InvokeArgumentAdl - a helper for InvokeArgument.
// internal::InvokeArgument - a helper for InvokeArgument action.
// The basic overloads are provided here for generic functors.
// Overloads for other custom-callables are provided in the
// internal/custom/gmock-generated-actions.h header.
template <typename F, typename... Args>
auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) {
auto InvokeArgument(F f, Args... args) -> decltype(f(args...)) {
return f(args...);
}
} // namespace invoke_argument
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \
, const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \

View File

@ -47,6 +47,8 @@
#include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h"
// Include any custom callback actions added by the local installation.
#include "gmock/internal/custom/gmock-generated-actions.h"
// Sometimes you want to give an action explicit template parameters
// that cannot be inferred from its value parameters. ACTION() and
@ -511,91 +513,71 @@ namespace testing {
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_0_VALUE_PARAMS()) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args));
return internal::InvokeArgument(::std::get<k>(args));
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(p0)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0);
return internal::InvokeArgument(::std::get<k>(args), p0);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_2_VALUE_PARAMS(p0, p1)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1);
return internal::InvokeArgument(::std::get<k>(args), p0, p1);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_3_VALUE_PARAMS(p0, p1, p2)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4, p5);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
p6);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
p6, p7);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7,
p8);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
p6, p7, p8);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7,
p8, p9);
return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
p6, p7, p8, p9);
}
#ifdef _MSC_VER
@ -604,9 +586,4 @@ ACTION_TEMPLATE(InvokeArgument,
} // namespace testing
// Include any custom callback actions added by the local installation.
// We must include this header at the end to make sure it can use the
// declarations from this file.
#include "gmock/internal/custom/gmock-generated-actions.h"
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_

View File

@ -49,6 +49,9 @@ $$}} This meta comment fixes auto-indentation in editors.
#include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h"
// Include any custom callback actions added by the local installation.
#include "gmock/internal/custom/gmock-generated-actions.h"
$range i 0..n
$range k 0..n-1
@ -333,9 +336,7 @@ $range j 0..i-1
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) {
using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
::std::get<k>(args)$for j[[, p$j]]);
return internal::InvokeArgument(::std::get<k>(args)$for j[[, p$j]]);
}
]]
@ -346,9 +347,4 @@ ACTION_TEMPLATE(InvokeArgument,
} // namespace testing
// Include any custom callback actions added by the local installation.
// We must include this header at the end to make sure it can use the
// declarations from this file.
#include "gmock/internal/custom/gmock-generated-actions.h"
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_