Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid spurrious auto-loading/parsing due to artificial classes.
artificial/synthetic classes are created in the support of I/O customization rules.
  • Loading branch information
pcanal committed Sep 30, 2020
commit cd04b64fe66cc8d2758b5310cdec535097ca171f
7 changes: 7 additions & 0 deletions core/foundation/src/TClassEdit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,13 @@ void TClassEdit::GetNormalizedName(std::string &norm_name, std::string_view name
}

norm_name = std::string(name); // NOTE: Is that the shortest version?

if (name.find('@')) {
// If there is a @ symbol (followed by a version number) then this is a synthetic class name created
// from an already normalized name for the purpose of supporting schema evolution.
return;
}

// Remove the std:: and default template argument and insert the Long64_t and change basic_string to string.
TClassEdit::TSplitType splitname(norm_name.c_str(),(TClassEdit::EModType)(TClassEdit::kLong64 | TClassEdit::kDropStd | TClassEdit::kDropStlDefault | TClassEdit::kKeepOuterConst));
splitname.ShortType(norm_name, TClassEdit::kDropStd | TClassEdit::kDropStlDefault | TClassEdit::kResolveTypedef | TClassEdit::kKeepOuterConst);
Expand Down
11 changes: 10 additions & 1 deletion core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ void TClass::Init(const char *name, Version_t cversion,
// We need to check if the class it is not fwd declared for the cases where we
// created a TClass directly in the kForwardDeclared state. Indeed in those cases
// fClassInfo will always be nullptr.
if (fState!=kForwardDeclared && !fClassInfo) {
if (fState!=kForwardDeclared && !fClassInfo && fName.First('@')==kNPOS) {

if (fState == kHasTClassInit) {
// If the TClass is being generated from a ROOT dictionary,
Expand Down Expand Up @@ -2971,6 +2971,15 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent)
load = kTRUE;
}

if (strchr(name, '@') != nullptr) {
// If there is a @ symbol (followed by a version number) then this is a synthetic class name created
// from an already normalized name for the purpose of supporting schema evolution.
// There is no dictionary or interpreter information about this kind of class, the only
// (undesirable) side-effect of doing the search would be a waste of CPU time and potential
// auto-loading or auto-parsing based on the scope of the name.
return cl;
}

// To avoid spurious auto parsing, let's check if the name as-is is
// known in the TClassTable.
DictFuncPtr_t dict = TClassTable::GetDictNorm(name);
Expand Down