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
Introduce TClassEdit::IsArtificial to wrap the '@' search.
just in case we need to make it more complexe and/or replace it at a later date
  • Loading branch information
pcanal committed Sep 30, 2020
commit c7930cfc7c323cbaa261a1bb755e2523d45b99fb
2 changes: 2 additions & 0 deletions core/foundation/inc/TClassEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ namespace TClassEdit {
void Init(TClassEdit::TInterpreterLookupHelper *helper);

std::string CleanType (const char *typeDesc,int mode = 0,const char **tail=0);
inline bool IsArtificial(std::string_view name) { return name.find('@') != name.npos; }
inline bool IsArtificial(ROOT::Internal::TStringView name) {return IsArtificial(std::string_view(name)); }
bool IsDefAlloc(const char *alloc, const char *classname);
bool IsDefAlloc(const char *alloc, const char *keyclassname, const char *valueclassname);
bool IsDefComp (const char *comp , const char *classname);
Expand Down
2 changes: 1 addition & 1 deletion core/foundation/src/TClassEdit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ 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 (TClassEdit::IsArtificial(name)) {
// 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;
Expand Down
8 changes: 4 additions & 4 deletions core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ TClass::TClass(const char *name, Bool_t silent) :
::Fatal("TClass::TClass", "gInterpreter not initialized");

gInterpreter->SetClassInfo(this); // sets fClassInfo pointer
if (!silent && !fClassInfo && fName.First('@')==kNPOS)
if (!silent && !fClassInfo && !TClassEdit::IsArtificial(name))
::Warning("TClass::TClass", "no dictionary for class %s is available", name);
ResetBit(kLoading);

Expand Down 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 && fName.First('@')==kNPOS) {
if (fState!=kForwardDeclared && !fClassInfo && !TClassEdit::IsArtificial(fName)) {

if (fState == kHasTClassInit) {
// If the TClass is being generated from a ROOT dictionary,
Expand Down Expand Up @@ -1483,7 +1483,7 @@ void TClass::Init(const char *name, Version_t cversion,
}
}
}
if (!silent && (!fClassInfo && !fCanLoadClassInfo) && !isStl && fName.First('@')==kNPOS &&
if (!silent && (!fClassInfo && !fCanLoadClassInfo) && !isStl && !TClassEdit::IsArtificial(fName) &&
!TClassEdit::IsInterpreterDetail(fName.Data()) ) {
if (fState == kHasTClassInit) {
if (fImplFileLine == -1 && fClassVersion == 0) {
Expand Down Expand Up @@ -2971,7 +2971,7 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent)
load = kTRUE;
}

if (strchr(name, '@') != nullptr) {
if (TClassEdit::IsArtificial(name)) {
// 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
Expand Down