|
13 | 13 |
|
14 | 14 | namespace llvm {
|
15 | 15 |
|
16 |
| -namespace detail { |
17 |
| -template <typename DesiredTypeName> inline StringRef getTypeNameImpl() { |
| 16 | +/// We provide a function which tries to compute the (demangled) name of a type |
| 17 | +/// statically. |
| 18 | +/// |
| 19 | +/// This routine may fail on some platforms or for particularly unusual types. |
| 20 | +/// Do not use it for anything other than logging and debugging aids. It isn't |
| 21 | +/// portable or dependendable in any real sense. |
| 22 | +/// |
| 23 | +/// The returned StringRef will point into a static storage duration string. |
| 24 | +/// However, it may not be null terminated and may be some strangely aligned |
| 25 | +/// inner substring of a larger string. |
| 26 | +template <typename DesiredTypeName> |
| 27 | +inline StringRef getTypeName() { |
18 | 28 | #if defined(__clang__) || defined(__GNUC__)
|
19 | 29 | StringRef Name = __PRETTY_FUNCTION__;
|
20 | 30 |
|
@@ -48,22 +58,6 @@ template <typename DesiredTypeName> inline StringRef getTypeNameImpl() {
|
48 | 58 | return "UNKNOWN_TYPE";
|
49 | 59 | #endif
|
50 | 60 | }
|
51 |
| -} // namespace detail |
52 |
| - |
53 |
| -/// We provide a function which tries to compute the (demangled) name of a type |
54 |
| -/// statically. |
55 |
| -/// |
56 |
| -/// This routine may fail on some platforms or for particularly unusual types. |
57 |
| -/// Do not use it for anything other than logging and debugging aids. It isn't |
58 |
| -/// portable or dependendable in any real sense. |
59 |
| -/// |
60 |
| -/// The returned StringRef will point into a static storage duration string. |
61 |
| -/// However, it may not be null terminated and may be some strangely aligned |
62 |
| -/// inner substring of a larger string. |
63 |
| -template <typename DesiredTypeName> inline StringRef getTypeName() { |
64 |
| - static StringRef Name = detail::getTypeNameImpl<DesiredTypeName>(); |
65 |
| - return Name; |
66 |
| -} |
67 | 61 |
|
68 | 62 | } // namespace llvm
|
69 | 63 |
|
|
0 commit comments