Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
fc66ae45
Unverified
Commit
fc66ae45
authored
May 10, 2018
by
James Dennett
Committed by
GitHub
May 10, 2018
Browse files
Update generated code.
parent
b8fa4d27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
googletest/include/gtest/internal/gtest-type-util.h
googletest/include/gtest/internal/gtest-type-util.h
+18
-2
No files found.
googletest/include/gtest/internal/gtest-type-util.h
View file @
fc66ae45
...
@@ -56,6 +56,22 @@
...
@@ -56,6 +56,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 constexpr char prefix[] = "std::__";
if (s.compare(0, strlen(prefix), prefix) == 0) {
auto end = s.find("::", strlen(prefix));
if (end != s.npos) {
// Erase the `::__` plus whatever was between that and the next `::`.
s.erase(strlen("std"), strlen("::__") + end - strlen(prefix));
}
}
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
...
@@ -73,9 +89,9 @@ std::string GetTypeName() {
...
@@ -73,9 +89,9 @@ std::string GetTypeName() {
using abi::__cxa_demangle;
using abi::__cxa_demangle;
# endif // GTEST_HAS_CXXABI_H_
# endif // GTEST_HAS_CXXABI_H_
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);
std::string name_str(status == 0 ? readable_name : name);
free(readable_name);
free(readable_name);
return name_str;
return
CanonicalizeForStdLibVersioning(std::move(
name_str
))
;
# else
# else
return name;
return name;
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment