Commit 1cd979a8 authored by Tanzinul Islam's avatar Tanzinul Islam
Browse files

Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116

parents 32800999 e5e2ef7c
...@@ -34,6 +34,8 @@ $$ This meta comment fixes auto-indentation in Emacs. }} ...@@ -34,6 +34,8 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// Implements a subset of TR1 tuple needed by Google Test and Google Mock. // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
...@@ -57,6 +59,22 @@ ...@@ -57,6 +59,22 @@
namespace testing { namespace testing {
namespace internal { namespace internal {
// Canonicalizes a given name with respect to the Standard C++ Library.
// This handles removing the inline namespace within `std` that is
// used by various standard libraries (e.g., `std::__1`). Names outside
// of namespace std are returned unmodified.
inline std::string CanonicalizeForStdLibVersioning(std::string s) {
static const char prefix[] = "std::__";
if (s.compare(0, strlen(prefix), prefix) == 0) {
std::string::size_type end = s.find("::", strlen(prefix));
if (end != s.npos) {
// Erase everything between the initial `std` and the second `::`.
s.erase(strlen("std"), end - strlen("std"));
}
}
return s;
}
// GetTypeName<T>() returns a human-readable name of type T. // GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of // NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below. // the typed-test-only section below.
...@@ -75,7 +93,7 @@ std::string GetTypeName() { ...@@ -75,7 +93,7 @@ std::string GetTypeName() {
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const std::string name_str(status == 0 ? readable_name : name); const std::string name_str(status == 0 ? readable_name : name);
free(readable_name); free(readable_name);
return name_str; return CanonicalizeForStdLibVersioning(name_str);
# else # else
return name; return name;
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
......
...@@ -39,6 +39,8 @@ $var n = 50 $$ Maximum length of type lists we want to support. ...@@ -39,6 +39,8 @@ $var n = 50 $$ Maximum length of type lists we want to support.
// Please contact googletestframework@googlegroups.com if you need // Please contact googletestframework@googlegroups.com if you need
// more. // more.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
...@@ -55,6 +57,22 @@ $var n = 50 $$ Maximum length of type lists we want to support. ...@@ -55,6 +57,22 @@ $var n = 50 $$ Maximum length of type lists we want to support.
namespace testing { namespace testing {
namespace internal { namespace internal {
// Canonicalizes a given name with respect to the Standard C++ Library.
// This handles removing the inline namespace within `std` that is
// used by various standard libraries (e.g., `std::__1`). Names outside
// of namespace std are returned unmodified.
inline std::string CanonicalizeForStdLibVersioning(std::string s) {
static const char prefix[] = "std::__";
if (s.compare(0, strlen(prefix), prefix) == 0) {
std::string::size_type end = s.find("::", strlen(prefix));
if (end != s.npos) {
// Erase everything between the initial `std` and the second `::`.
s.erase(strlen("std"), end - strlen("std"));
}
}
return s;
}
// GetTypeName<T>() returns a human-readable name of type T. // GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of // NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below. // the typed-test-only section below.
...@@ -73,7 +91,7 @@ std::string GetTypeName() { ...@@ -73,7 +91,7 @@ std::string GetTypeName() {
char* const readable_name = __cxa_demangle(name, 0, 0, &status); char* const readable_name = __cxa_demangle(name, 0, 0, &status);
const std::string name_str(status == 0 ? readable_name : name); const std::string name_str(status == 0 ? readable_name : name);
free(readable_name); free(readable_name);
return name_str; return CanonicalizeForStdLibVersioning(name_str);
# else # else
return name; return name;
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
......
...@@ -52,7 +52,7 @@ EXAMPLES ...@@ -52,7 +52,7 @@ EXAMPLES
This tool is experimental. In particular, it assumes that there is no This tool is experimental. In particular, it assumes that there is no
conditional inclusion of Google Test headers. Please report any conditional inclusion of Google Test headers. Please report any
problems to googletestframework@googlegroups.com. You can read problems to googletestframework@googlegroups.com. You can read
https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md for https://github.com/google/googletest/blob/master/googletest/docs/advanced.md for
more information. more information.
""" """
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// //
// Author: mheule@google.com (Markus Heule) // Author: mheule@google.com (Markus Heule)
// //
// Google C++ Testing Framework (Google Test) // Google C++ Testing and Mocking Framework (Google Test)
// //
// Sometimes it's desirable to build Google Test by compiling a single file. // Sometimes it's desirable to build Google Test by compiling a single file.
// This file serves this purpose. // This file serves this purpose.
......
This diff is collapsed.
...@@ -446,6 +446,16 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface { ...@@ -446,6 +446,16 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
virtual void UponLeavingGTest(); virtual void UponLeavingGTest();
private: private:
#if GTEST_HAS_ABSL
Mutex mutex_; // Protects all internal state.
// We save the stack frame below the frame that calls user code.
// We do this because the address of the frame immediately below
// the user code changes between the call to UponLeavingGTest()
// and any calls to the stack trace code from within the user code.
void* caller_frame_ = nullptr;
#endif // GTEST_HAS_ABSL
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter); GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment