MCPcopy Create free account
hub / github.com/apache/singa / HandleSehExceptionsInMethodIfSupported

Function HandleSehExceptionsInMethodIfSupported

test/gtest/gtest-all.cc:3543–3564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3541// wrapper function for handling SEH exceptions.)
3542template <class T, typename Result>
3543Result HandleSehExceptionsInMethodIfSupported(
3544 T* object, Result (T::*method)(), const char* location) {
3545#if GTEST_HAS_SEH
3546 __try {
3547 return (object->*method)();
3548 } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
3549 GetExceptionCode())) {
3550 // We create the exception message on the heap because VC++ prohibits
3551 // creation of objects with destructors on stack in functions using __try
3552 // (see error C2712).
3553 std::string* exception_message = FormatSehExceptionMessage(
3554 GetExceptionCode(), location);
3555 internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
3556 *exception_message);
3557 delete exception_message;
3558 return static_cast<Result>(0);
3559 }
3560#else
3561 (void)location;
3562 return (object->*method)();
3563#endif // GTEST_HAS_SEH
3564}
3565
3566// Runs the given method and catches and reports C++ and/or SEH-style
3567// exceptions, if they are supported; returns the 0-value for type

Callers 1

Calls 2

Tested by

no test coverage detected