Skip to content

Commit c3129ba

Browse files
committed
meta: Allow global disabling of AutoParsing during TClass::GetClass
If TClass.cxx is build with the cpp macro: ROOT_DISABLE_TCLASS_GET_CLASS_AUTOPARSING defined, it will no longer do any auto-parsing during the execution of `TClass::GetClass`. This will result in not being able to find TClass-es when the name requires not-already loaded interpreted information (eg. a typedef to be resolved). Comments include additional possible interfaces to turn on this feature.
1 parent d1717fa commit c3129ba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/meta/src/TClass.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,21 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent, size_t hi
31493149
// continue as before ...
31503150
}
31513151

3152+
bool disableAutoParsing = gInterpreter->IsAutoParsingSuspended();
3153+
// FIXME: We need to decided on the interface to disable auto-parsing only during TClass::GetClass.
3154+
#ifdef ROOT_DISABLE_TCLASS_GET_CLASS_AUTOPARSING
3155+
constexpr bool requestDisableAutoLoading = true;
3156+
#else
3157+
// We could get the user choice from:
3158+
// - environment variable ROOT_DISABLE_TCLASS_GET_CLASS_AUTOPARSING
3159+
// - rootrc key Root.TClass.GetClass.AutoParsing
3160+
// - TClass::SetGetClassAutoParsing
3161+
constexpr bool requestDisableAutoLoading = false;
3162+
#endif
3163+
if(requestDisableAutoLoading)
3164+
disableAutoParsing = true;
3165+
TInterpreter::SuspendAutoParsing autoparseFence(gInterpreter, disableAutoParsing);
3166+
31523167
// Note: this variable does not always holds the fully normalized name
31533168
// as there is information from a not yet loaded library or from header
31543169
// not yet parsed that may be needed to fully normalize the name.

0 commit comments

Comments
 (0)