Skip to content

Commit a82fb68

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 aa645d7 commit a82fb68

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
@@ -3153,6 +3153,21 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent, size_t hi
31533153
// continue as before ...
31543154
}
31553155

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

0 commit comments

Comments
 (0)