Chromium Code Reviews| 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) |
|
gab
2016/12/05 18:51:48
The last comment below makes this not compiler spe
|
| +#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() { |
|
gab
2016/12/05 18:51:48
Given this is only used in base/allocator it shoul
palmer
2016/12/06 00:58:25
Turns out I can leave it in WTF (since I moved wtf
|
| + return PRETTY_FUNCTION; |
|
gab
2016/12/05 18:51:48
I think typeid(T).name() would be cleaner here?
h
palmer
2016/12/06 00:58:25
It would be, but the compiler says: "error: cannot
gab
2016/12/06 15:43:21
Interesting, I couldn't find where this flag is se
|
| +} |
| + |
| #endif // BASE_COMPILER_SPECIFIC_H_ |