@@ -83,14 +83,14 @@ class TClingMethodInfo::SpecIterator
83
83
};
84
84
85
85
TClingMethodInfo::TClingMethodInfo (const TClingMethodInfo &rhs) :
86
+ TClingDeclInfo(rhs),
86
87
fInterp(rhs.fInterp ),
87
88
fContexts(rhs.fContexts ),
88
89
fFirstTime(rhs.fFirstTime ),
89
90
fContextIdx(rhs.fContextIdx ),
90
91
fIter(rhs.fIter ),
91
92
fTitle(rhs.fTitle ),
92
- fTemplateSpecIter(nullptr ),
93
- fSingleDecl(rhs.fSingleDecl )
93
+ fTemplateSpecIter(nullptr )
94
94
{
95
95
if (rhs.fTemplateSpecIter ) {
96
96
// The SpecIterator query the decl.
@@ -102,8 +102,8 @@ TClingMethodInfo::TClingMethodInfo(const TClingMethodInfo &rhs) :
102
102
103
103
TClingMethodInfo::TClingMethodInfo (cling::Interpreter *interp,
104
104
TClingClassInfo *ci)
105
- : fInterp(interp), fFirstTime(true ), fContextIdx(0U ), fTitle(" " ),
106
- fTemplateSpecIter(0 ), fSingleDecl( 0 )
105
+ : TClingDeclInfo( nullptr ), fInterp(interp), fFirstTime(true ), fContextIdx(0U ), fTitle(" " ),
106
+ fTemplateSpecIter(0 )
107
107
{
108
108
R__LOCKGUARD (gInterpreterMutex );
109
109
@@ -131,8 +131,8 @@ TClingMethodInfo::TClingMethodInfo(cling::Interpreter *interp,
131
131
132
132
TClingMethodInfo::TClingMethodInfo (cling::Interpreter *interp,
133
133
const clang::FunctionDecl *FD)
134
- : fInterp(interp), fFirstTime(true ), fContextIdx(0U ), fTitle(" " ),
135
- fTemplateSpecIter(0 ), fSingleDecl(FD)
134
+ : TClingDeclInfo(FD), fInterp(interp), fFirstTime(true ), fContextIdx(0U ), fTitle(" " ),
135
+ fTemplateSpecIter(0 )
136
136
{
137
137
138
138
}
@@ -152,17 +152,7 @@ TDictionary::DeclId_t TClingMethodInfo::GetDeclId() const
152
152
153
153
const clang::FunctionDecl *TClingMethodInfo::GetMethodDecl () const
154
154
{
155
- if (!IsValid ()) {
156
- return 0 ;
157
- }
158
-
159
- if (fSingleDecl )
160
- return fSingleDecl ;
161
-
162
- if (fTemplateSpecIter )
163
- return *(*fTemplateSpecIter );
164
-
165
- return llvm::dyn_cast<clang::FunctionDecl>(*fIter );
155
+ return cast_or_null<FunctionDecl>(GetDecl ());
166
156
}
167
157
168
158
void TClingMethodInfo::CreateSignature (TString &signature) const
@@ -203,7 +193,7 @@ void TClingMethodInfo::Init(const clang::FunctionDecl *decl)
203
193
fIter = clang::DeclContext::decl_iterator ();
204
194
delete fTemplateSpecIter ;
205
195
fTemplateSpecIter = 0 ;
206
- fSingleDecl = decl;
196
+ fDecl = decl;
207
197
}
208
198
209
199
void *TClingMethodInfo::InterfaceMethod (const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
@@ -217,7 +207,7 @@ void *TClingMethodInfo::InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt
217
207
return cf.InterfaceMethod ();
218
208
}
219
209
220
- bool TClingMethodInfo::IsValidSlow () const
210
+ const clang::Decl* TClingMethodInfo::GetDeclSlow () const
221
211
{
222
212
if (fTemplateSpecIter ) {
223
213
// Could trigger deserialization of decls.
@@ -374,7 +364,9 @@ static void InstantiateFuncTemplateWithDefaults(clang::FunctionTemplateDecl* FTD
374
364
int TClingMethodInfo::InternalNext ()
375
365
{
376
366
377
- assert (!fSingleDecl && " This is not an iterator!" );
367
+ assert (!fDecl && " This is not an iterator!" );
368
+
369
+ fNameCache .clear (); // invalidate the cache.
378
370
379
371
if (!fFirstTime && !*fIter ) {
380
372
// Iterator is already invalid.
@@ -619,7 +611,7 @@ std::string TClingMethodInfo::GetMangledName() const
619
611
return mangled_name;
620
612
}
621
613
622
- const char *TClingMethodInfo::GetPrototype (const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
614
+ const char *TClingMethodInfo::GetPrototype ()
623
615
{
624
616
if (!IsValid ()) {
625
617
return 0 ;
@@ -643,7 +635,7 @@ const char *TClingMethodInfo::GetPrototype(const ROOT::TMetaUtils::TNormalizedCt
643
635
buf += name;
644
636
buf += " ::" ;
645
637
}
646
- buf += Name (normCtxt );
638
+ buf += Name ();
647
639
buf += ' (' ;
648
640
TClingMethodArgInfo arg (fInterp , this );
649
641
int idx = 0 ;
@@ -672,14 +664,16 @@ const char *TClingMethodInfo::GetPrototype(const ROOT::TMetaUtils::TNormalizedCt
672
664
return buf.c_str ();
673
665
}
674
666
675
- const char *TClingMethodInfo::Name (const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
667
+ const char *TClingMethodInfo::Name ()
676
668
{
677
669
if (!IsValid ()) {
678
670
return 0 ;
679
671
}
680
- TTHREAD_TLS_DECL ( std::string, buf );
681
- ((TCling*)gCling )->GetFunctionName (GetMethodDecl (),buf);
682
- return buf.c_str ();
672
+ if (!fNameCache .empty ())
673
+ return fNameCache .c_str ();
674
+
675
+ ((TCling*)gCling )->GetFunctionName (GetMethodDecl (), fNameCache );
676
+ return fNameCache .c_str ();
683
677
}
684
678
685
679
const char *TClingMethodInfo::TypeName () const
0 commit comments