diff options
author | ofats <ofats@google.com> | 2020-07-26 12:05:02 (GMT) |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-07-28 18:21:59 (GMT) |
commit | c64309924d2119e2a80bfc1f261189901d384822 (patch) | |
tree | e63512a08b1345d1dbd256eb90d4c1f265d1ed68 /googlemock | |
parent | a781fe29bcf73003559a3583167fe3d647518464 (diff) | |
download | googletest-c64309924d2119e2a80bfc1f261189901d384822.zip googletest-c64309924d2119e2a80bfc1f261189901d384822.tar.gz googletest-c64309924d2119e2a80bfc1f261189901d384822.tar.bz2 |
Googletest export
Stop using ADL for InvokeArgument action.
PiperOrigin-RevId: 323234396
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/docs/cheat_sheet.md | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 12 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-generated-actions.h | 57 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-generated-actions.h.pump | 12 |
4 files changed, 24 insertions, 59 deletions
diff --git a/googlemock/docs/cheat_sheet.md b/googlemock/docs/cheat_sheet.md index 85620f7..e02d1d6 100644 --- a/googlemock/docs/cheat_sheet.md +++ b/googlemock/docs/cheat_sheet.md @@ -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} diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index ecf47c4..79054db 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -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_ \ diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 7030a98..ccae611 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -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_ diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 3430204..1512d72 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -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_ |