Index: base/compiler_specific.h |
diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
index 0f4c058b3be43963d76c23b0b3b8ec89fc8b3767..278ef924f91ee36a70bf4042ecfd3aebd930ef72 100644 |
--- a/base/compiler_specific.h |
+++ b/base/compiler_specific.h |
@@ -230,4 +230,18 @@ |
#define HAS_FEATURE(FEATURE) 0 |
#endif |
+#if defined(COMPILER_GCC) |
+#define PRETTY_FUNCTION __PRETTY_FUNCTION__ |
+#elif defined(COMPILER_MSVC) |
+#define PRETTY_FUNCTION __FUNCSIG__ |
+#else |
+#define PRETTY_FUNCTION __func__ |
+#endif |
+ |
+// Returns a string that contains the type name of |T| as a substring. |
+template <typename T> |
+inline const char* GetStringWithTypeName() { |
+ return PRETTY_FUNCTION; |
+} |
+ |
#endif // BASE_COMPILER_SPECIFIC_H_ |