| 13979 | BiggestInt rhs); |
| 13980 | |
| 13981 | class EqHelper { |
| 13982 | public: |
| 13983 | // This templatized version is for the general case. |
| 13984 | template < |
| 13985 | typename T1, typename T2, |
| 13986 | // Disable this overload for cases where one argument is a pointer |
| 13987 | // and the other is the null pointer constant. |
| 13988 | typename std::enable_if<!std::is_integral<T1>::value || |
| 13989 | !std::is_pointer<T2>::value>::type* = nullptr> |
| 13990 | static AssertionResult Compare(const char* lhs_expression, |
| 13991 | const char* rhs_expression, const T1& lhs, |
| 13992 | const T2& rhs) { |
| 13993 | return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); |
| 13994 | } |
| 13995 | |
| 13996 | // With this overloaded version, we allow anonymous enums to be used |
| 13997 | // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous |
| 13998 | // enums can be implicitly cast to BiggestInt. |
| 13999 | // |
| 14000 | // Even though its body looks the same as the above version, we |
| 14001 | // cannot merge the two, as it will make anonymous enums unhappy. |
| 14002 | static AssertionResult Compare(const char* lhs_expression, |
| 14003 | const char* rhs_expression, |
| 14004 | BiggestInt lhs, |
| 14005 | BiggestInt rhs) { |
| 14006 | return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); |
| 14007 | } |
| 14008 | |
| 14009 | template <typename T> |
| 14010 | static AssertionResult Compare( |
| 14011 | const char* lhs_expression, const char* rhs_expression, |
| 14012 | // Handle cases where '0' is used as a null pointer literal. |
| 14013 | std::nullptr_t /* lhs */, T* rhs) { |
| 14014 | // We already know that 'lhs' is a null pointer. |
| 14015 | return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr), |
| 14016 | rhs); |
| 14017 | } |
| 14018 | }; |
| 14019 | |
| 14020 | // Separate the error generating code from the code path to reduce the stack |
| 14021 | // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers |
nothing calls this directly
no outgoing calls
no test coverage detected