File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -104,13 +104,12 @@ const char *TClingTypeInfo::Name() const
104
104
if (!IsValid ()) {
105
105
return " " ;
106
106
}
107
- // Note: This *must* be static because we are returning a pointer inside it!
108
- TTHREAD_TLS_DECL ( std::string, buf);
109
- buf.clear ();
107
+ if (!fNameCache .empty ())
108
+ return fNameCache .c_str ();
110
109
111
110
R__LOCKGUARD (gInterpreterMutex );
112
- ROOT::TMetaUtils::GetFullyQualifiedTypeName (buf, fQualType ,*fInterp );
113
- return buf .c_str ();
111
+ ROOT::TMetaUtils::GetFullyQualifiedTypeName (fNameCache , fQualType , *fInterp );
112
+ return fNameCache .c_str ();
114
113
}
115
114
116
115
// //////////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change 27
27
28
28
#include " clang/AST/Type.h"
29
29
30
+ #include < string>
31
+
30
32
namespace cling {
31
33
class Interpreter ;
32
34
}
@@ -42,6 +44,8 @@ class TClingTypeInfo {
42
44
private:
43
45
cling::Interpreter *fInterp ; // Cling interpreter, we do *not* own.
44
46
clang::QualType fQualType ; // Clang qualified type we are querying.
47
+ // FIXME: Factor out in the TClingGenericInfo or a similar concept.
48
+ mutable std::string fNameCache ;
45
49
46
50
public:
47
51
@@ -53,6 +57,13 @@ class TClingTypeInfo {
53
57
54
58
TClingTypeInfo (cling::Interpreter *interp, const char *name);
55
59
60
+ TClingTypeInfo (TClingTypeInfo& rhs)
61
+ {
62
+ fInterp = rhs.fInterp ;
63
+ fQualType = rhs.fQualType ;
64
+ fNameCache = " " ; // we must not copy the cache.
65
+ }
66
+
56
67
cling::Interpreter *GetInterpreter () const { return fInterp ; }
57
68
58
69
clang::QualType GetQualType () const { return fQualType ; }
You can’t perform that action at this time.
0 commit comments