File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
llvm/include/llvm/Support Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change 1313
1414namespace llvm {
1515
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 () {
16+ namespace detail {
17+ template <typename DesiredTypeName> inline StringRef getTypeNameImpl () {
2818#if defined(__clang__) || defined(__GNUC__)
2919 StringRef Name = __PRETTY_FUNCTION__;
3020
@@ -58,6 +48,22 @@ inline StringRef getTypeName() {
5848 return " UNKNOWN_TYPE" ;
5949#endif
6050}
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+ }
6167
6268} // namespace llvm
6369
You can’t perform that action at this time.
0 commit comments