diff --git a/core/rint/src/TTabCom.cxx b/core/rint/src/TTabCom.cxx index 7977a54775b80..8af741db377fb 100644 --- a/core/rint/src/TTabCom.cxx +++ b/core/rint/src/TTabCom.cxx @@ -2409,8 +2409,9 @@ TClass *TTabCom::MakeClassFromVarName(const char varName[], // not found... if (!varName_exists) { - std::cerr << std::endl << "variable " << dblquote(varName) << " not defined." - << std::endl; + if (cut == 0) { + std::cerr << std::endl << "variable " << dblquote(varName) << " not defined." << std::endl; + } return nullptr; //* RETURN *// } @@ -2500,6 +2501,20 @@ TClass *TTabCom::MakeClassFromVarName(const char varName[], return nullptr; // RETURN } } else { + // Find the TClass and see if the object has an operator->, for example if it is a smart pointer. + auto cl = TClass::GetClass(className); + if (cl != nullptr) { + auto op = cl->GetMethod("operator->", ""); + if (op != nullptr) { + // Get the return type and remove the '*', which should be there + className = op->GetReturnTypeNormalizedName(); + if (className[className.Length() - 1] == '*') { + className.Chop(); + } + return TClass::GetClass(className); + } + } + // user is using operator->() instead of operator.() // ==> // 1. we are in wrong context. diff --git a/roottest/root/rint/TabCom.eref b/roottest/root/rint/TabCom.eref index c4117fcc12b60..04e768f57f99f 100644 --- a/roottest/root/rint/TabCom.eref +++ b/roottest/root/rint/TabCom.eref @@ -1,27 +1,37 @@ -ROOT_prompt_1:1:10: error: no member named 'k' in 'TObject' +ROOT_prompt_0:1:10: error: no member named 'k' in 'TObject' TObject::k ~~~~~~~~~^ -ROOT_prompt_2:1:8: error: no member named 'GetListOfT' in 'TROOT' +ROOT_prompt_1:1:8: error: no member named 'GetListOfT' in 'TROOT' gROOT->GetListOfT ~~~~~ ^ -ROOT_prompt_8:1:10: error: no member named 'fgPrivateM' in 'MyClass' +ROOT_prompt_7:1:10: error: no member named 'fgPrivateM' in 'MyClass' MyClass::fgPrivateM ~~~~~~~~~^ -ROOT_prompt_10:1:16: error: no member named 'SetTi' in 'TAxis' +ROOT_prompt_9:1:16: error: no member named 'SetTi' in 'TAxis' h->GetXaxis()->SetTi ~~~~~~~~~~~~~ ^ -ROOT_prompt_12:2:1: error: expected unqualified-id +variable "x" not defined. +ROOT_prompt_10:2:1: error: expected unqualified-id +; +^ +variable "x" not defined. +ROOT_prompt_11:2:1: error: expected unqualified-id ; ^ ROOT_prompt_14:2:1: error: expected unqualified-id ; ^ -ROOT_prompt_16:2:1: error: expected unqualified-id +"s" is not of pointer type. Use this operator: . +ROOT_prompt_15:2:1: error: expected unqualified-id ; ^ -ROOT_prompt_18:2:1: error: expected unqualified-id +ROOT_prompt_17:2:1: error: expected unqualified-id ; ^ +ROOT_prompt_19:2:1: error: expected unqualified-id +; +^ +"ps" is of pointer type. Use this operator: -> ROOT_prompt_20:2:1: error: expected unqualified-id ; ^ @@ -34,3 +44,12 @@ ROOT_prompt_24:2:1: error: expected unqualified-id ROOT_prompt_26:2:1: error: expected unqualified-id ; ^ +ROOT_prompt_28:2:1: error: expected unqualified-id +; +^ +ROOT_prompt_30:2:1: error: expected unqualified-id +; +^ +ROOT_prompt_32:2:1: error: expected unqualified-id +; +^ diff --git a/roottest/root/rint/TabCom.oref b/roottest/root/rint/TabCom.oref index 1d8678ef837e4..9b85e0735cc05 100644 --- a/roottest/root/rint/TabCom.oref +++ b/roottest/root/rint/TabCom.oref @@ -8,13 +8,19 @@ MyCla ::fgM MyCla ::fgPrivateM TH1F *h = 0; h->GetXaxis()->SetTi +x. +x-> struct Simple {}; Simple s; s. +s-> const Simple cs{}; cs. Simple* ps = nullptr; ps-> +ps. +std::unique_ptr us; +us-> const Simple* pcs = nullptr; pcs-> Simple* const cps = nullptr; @@ -107,3 +113,7 @@ operator= Simple operator= ~Simple + +Simple +operator= +~Simple diff --git a/roottest/root/rint/TabCom.ref b/roottest/root/rint/TabCom.ref deleted file mode 100644 index 5e9edb61450d4..0000000000000 --- a/roottest/root/rint/TabCom.ref +++ /dev/null @@ -1,117 +0,0 @@ -TObj -TObject::k -gROOT->GetListOfT -TNamed tabComTestNamedObj("AName","ATitle"); -tabComTestNamedOb .SetTitl "OtherTitle") -tabComTestNamedOb .GetTitl () -#include "MyClass.h" -MyCla ::fgM -MyCla ::fgPrivateM -TH1F *h = 0; -h->GetXaxis()->SetTi -struct Simple {}; -Simple s; -s. -const Simple cs{}; -cs. -Simple* ps = nullptr; -ps-> -const Simple* pcs = nullptr; -pcs-> -Simple* const cps = nullptr; -cps-> -const Simple* const cpcs = nullptr; -cpcs-> -volatile Simple* vs = nullptr; -vs-> -const volatile Simple* cvs = nullptr; -cvs-> -.q - - -TObjArray -TObjArrayIter -TObjString -TObject -TObjectRefSpy -TObjectSpy -TObjectTable - -kBitMask -kCanDelete -kCannotPick -kHasUUID -kInvalidObject -kIsOnHeap -kIsReferenced -kMustCleanup -kNoContextMenu -kNotDeleted -kObjInCanvas -kOverwrite -kSingleKey -kWriteDelete -kZombie - -GetListOfTasks -GetListOfTypes - -void SetTitle(const char* title = "") // *MENU* -(const char *) "OtherTitle" -(int) 42 - -SetTickLength -SetTickSize -SetTicks -SetTimeDisplay -SetTimeFormat -SetTimeOffset -SetTitle -SetTitleColor -SetTitleFont -SetTitleOffset -SetTitleSize - -SetTickLength -SetTickSize -SetTicks -SetTimeDisplay -SetTimeFormat -SetTimeOffset -SetTitle -SetTitleColor -SetTitleFont -SetTitleOffset -SetTitleSize - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple - -Simple -operator= -~Simple diff --git a/roottest/root/rint/TabCom_input.txt b/roottest/root/rint/TabCom_input.txt index 503d34a95b8df..cb70388388811 100644 --- a/roottest/root/rint/TabCom_input.txt +++ b/roottest/root/rint/TabCom_input.txt @@ -8,13 +8,19 @@ MyCla ::fgM MyCla ::fgPrivateM TH1F *h = 0; h->GetXaxis()->SetTi +x. +x-> struct Simple {}; Simple s; s. +s-> const Simple cs{}; cs. Simple* ps = nullptr; ps-> +ps. +std::unique_ptr us; +us-> const Simple* pcs = nullptr; pcs-> Simple* const cps = nullptr;