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 auto-parsing if we can tell early that the name is an enumerator.
In particular use TEnum::GetEnum 'do-not-autoparse-nor-autoload' feature.
  • Loading branch information
pcanal committed Sep 30, 2020
commit 72c723b4860ff4473df85cc8f6729da6e7aee43c
4 changes: 4 additions & 0 deletions core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ In order to access the name of a class within the ROOT type system, the method T
#include "TDataMember.h"
#include "TDataType.h"
#include "TDatime.h"
#include "TEnum.h"
#include "TError.h"
#include "TExMap.h"
#include "TFunctionTemplate.h"
Expand Down Expand Up @@ -3037,6 +3038,9 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent)
if (gInterpreter->AutoLoad(normalizedName.c_str(),kTRUE)) {
loadedcl = LoadClassDefault(normalizedName.c_str(),silent);
}
auto e = TEnum::GetEnum(normalizedName.c_str(), TEnum::kNone);
if (e)
return nullptr;
// Maybe this was a typedef: let's try to see if this is the case
if (!loadedcl){
if (TDataType* theDataType = gROOT->GetType(normalizedName.c_str())){
Expand Down
6 changes: 2 additions & 4 deletions io/io/src/TGenCollectionProxy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "TClassEdit.h"
#include "TClass.h"
#include "TError.h"
#include "TEnum.h"
#include "TROOT.h"
#include "TInterpreter.h" // For gInterpreterMutex
#include "TVirtualMutex.h"
Expand Down Expand Up @@ -387,10 +388,7 @@ TGenCollectionProxy::Value::Value(const std::string& inside_type, Bool_t silent)
// Try to avoid autoparsing.

THashTable *typeTable = dynamic_cast<THashTable*>( gROOT->GetListOfTypes() );
THashList *enumTable = dynamic_cast<THashList*>( gROOT->GetListOfEnums() );

assert(typeTable && "The type of the list of type has changed");
assert(enumTable && "The type of the list of enum has changed");

TDataType *fundType = (TDataType *)typeTable->THashTable::FindObject( intype.c_str() );
if (fundType && fundType->GetType() < 0x17 && fundType->GetType() > 0) {
Expand All @@ -404,7 +402,7 @@ TGenCollectionProxy::Value::Value(const std::string& inside_type, Bool_t silent)
} else {
fSize = fundType->Size();
}
} else if (enumTable->THashList::FindObject( intype.c_str() ) ) {
} else if (TEnum::GetEnum( intype.c_str(), TEnum::kNone) ) {
// This is a known enum.
fCase = kIsEnum;
fSize = sizeof(Int_t);
Expand Down