From 66561a4abbc7aeb951dadcfc414d252573c25739 Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Wed, 17 Jul 2013 15:01:29 +0200 Subject: [PATCH 1/6] GetMissingDictionaries --- core/meta/inc/TClass.h | 3 +++ core/meta/inc/TInterpreter.h | 3 +++ core/meta/src/TClass.cxx | 8 ++++++ core/meta/src/TCling.cxx | 49 ++++++++++++++++++++++++++++++++++++ core/meta/src/TCling.h | 2 ++ 5 files changed, 65 insertions(+) diff --git a/core/meta/inc/TClass.h b/core/meta/inc/TClass.h index 44a8ae88b6021..809eda595a9c3 100644 --- a/core/meta/inc/TClass.h +++ b/core/meta/inc/TClass.h @@ -33,8 +33,10 @@ #ifndef ROOT_TObjString #include "TObjString.h" #endif + #include #include +#include class TBaseClass; class TBrowser; @@ -308,6 +310,7 @@ friend class ROOT::TGenericClassInfo; TVirtualStreamerInfo *GetStreamerInfo(Int_t version=0) const; TVirtualStreamerInfo *GetStreamerInfoAbstractEmulated(Int_t version=0) const; const type_info *GetTypeInfo() const { return fTypeInfo; }; + std::set GetMissingClassDictionaries(); void IgnoreTObjectStreamer(Bool_t ignore=kTRUE); Bool_t InheritsFrom(const char *cl) const; Bool_t InheritsFrom(const TClass *cl) const; diff --git a/core/meta/inc/TInterpreter.h b/core/meta/inc/TInterpreter.h index 820ec33caa57f..2f09e188f4b26 100644 --- a/core/meta/inc/TInterpreter.h +++ b/core/meta/inc/TInterpreter.h @@ -26,6 +26,8 @@ #include "TDictionary.h" #endif +#include + class TClass; class TEnv; class TFunction; @@ -73,6 +75,7 @@ class TInterpreter : public TNamed { virtual const char *GetIncludePath() = 0; virtual const char *GetSTLIncludePath() const { return ""; } virtual TObjArray *GetRootMapFiles() const = 0; + virtual std::set GetMissingDictionaries(TClass* cl) = 0; virtual void Initialize() = 0; virtual void InspectMembers(TMemberInspector&, void* obj, const TClass* cl) = 0; virtual Bool_t IsLoaded(const char *filename) const = 0; diff --git a/core/meta/src/TClass.cxx b/core/meta/src/TClass.cxx index 892274ec347b2..9efeb3c31f52b 100644 --- a/core/meta/src/TClass.cxx +++ b/core/meta/src/TClass.cxx @@ -3159,6 +3159,14 @@ void TClass::GetMenuItems(TList *list) } } +std::set TClass::GetMissingClassDictionaries() +{ + //Get the classes that have a missing dictionary. + + std::set clMissingDict = gInterpreter->GetMissingDictionaries(this); + return clMissingDict; +} + //______________________________________________________________________________ Bool_t TClass::IsFolder(void *obj) const { diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index a34c21fe5b023..c844bbe01b261 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2753,6 +2753,55 @@ const char* TCling::GetInterpreterTypeName(const char* name, Bool_t full) return result.c_str(); } +//______________________________________________________________________________ +namespace { + void GetMissingDictionariesForDecl(const clang::Decl* D, std::set &netD) + { + // Get the data members that do not have a dictionary for a Decl. + + // Convert to RecordDecl. + const clang::RecordDecl* RD = dyn_cast(D); + // If there is no RecordDecl there is no Dictionary + if (!RD) return; + + // Get the name of the class. + std::string name = dyn_cast(RD)->getQualifiedNameAsString(); + // Check for the dictionary of the curent class. + if (!gClassTable->GetDict(name.c_str())){ + netD.insert(D); + return ; + } + // Recurse for the data members. + for (clang::RecordDecl::decl_iterator RDI = RD->decls_begin() + , RDE = RD->decls_end(); RDI != RDE; ++RDI) { + GetMissingDictionariesForDecl(*RDI, netD); + } + + return ; + } +} +//______________________________________________________________________________ +std::set TCling::GetMissingDictionaries(TClass* cl) +{ + // Get the Tclass-s that do not have a dictionary. + + // Get the Decl for the class. + TClingClassInfo* cli = (TClingClassInfo*)cl->GetClassInfo(); + const clang::Decl* D = cli->GetDecl(); + + // Get the Decls recursively for all data members of TClass cl + + std::set netD; + GetMissingDictionariesForDecl(D, netD); + + //convert set to set + + //return the classes the have missing dictionaries + std::set clMissingDict; + if (netD.empty()) clMissingDict.insert(0); + return clMissingDict; +} + //______________________________________________________________________________ void TCling::Execute(const char* function, const char* params, int* error) { diff --git a/core/meta/src/TCling.h b/core/meta/src/TCling.h index 6ea53cd4c93e2..c93eef84ec86d 100644 --- a/core/meta/src/TCling.h +++ b/core/meta/src/TCling.h @@ -137,6 +137,8 @@ class TCling : public TInterpreter { const char* GetIncludePath(); virtual const char* GetSTLIncludePath() const; TObjArray* GetRootMapFiles() const { return fRootmapFiles; } + void GetMissingDictionariesForDecl(const clang::Decl* D, std::set netD); + std::set GetMissingDictionaries(TClass* cl); virtual void Initialize(); void InspectMembers(TMemberInspector&, void* obj, const TClass* cl); Bool_t IsLoaded(const char* filename) const; From d1a11fade3615eac59521f6285eab555ec9d2af0 Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Fri, 9 Aug 2013 17:24:39 +0200 Subject: [PATCH 2/6] Has dictionary with recurse flag. --- core/meta/inc/TClass.h | 2 +- core/meta/inc/TInterpreter.h | 2 +- core/meta/src/TClass.cxx | 4 +-- core/meta/src/TCling.cxx | 51 +++++++++++++++++++++++++++--------- core/meta/src/TCling.h | 4 +-- 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/core/meta/inc/TClass.h b/core/meta/inc/TClass.h index 809eda595a9c3..3a7237c218d01 100644 --- a/core/meta/inc/TClass.h +++ b/core/meta/inc/TClass.h @@ -310,7 +310,7 @@ friend class ROOT::TGenericClassInfo; TVirtualStreamerInfo *GetStreamerInfo(Int_t version=0) const; TVirtualStreamerInfo *GetStreamerInfoAbstractEmulated(Int_t version=0) const; const type_info *GetTypeInfo() const { return fTypeInfo; }; - std::set GetMissingClassDictionaries(); + std::set GetMissingClassDictionaries(bool recurse); void IgnoreTObjectStreamer(Bool_t ignore=kTRUE); Bool_t InheritsFrom(const char *cl) const; Bool_t InheritsFrom(const TClass *cl) const; diff --git a/core/meta/inc/TInterpreter.h b/core/meta/inc/TInterpreter.h index 2f09e188f4b26..da0e18e36a16c 100644 --- a/core/meta/inc/TInterpreter.h +++ b/core/meta/inc/TInterpreter.h @@ -75,7 +75,7 @@ class TInterpreter : public TNamed { virtual const char *GetIncludePath() = 0; virtual const char *GetSTLIncludePath() const { return ""; } virtual TObjArray *GetRootMapFiles() const = 0; - virtual std::set GetMissingDictionaries(TClass* cl) = 0; + virtual std::set GetMissingDictionaries(TClass* cl, bool recurse) = 0; virtual void Initialize() = 0; virtual void InspectMembers(TMemberInspector&, void* obj, const TClass* cl) = 0; virtual Bool_t IsLoaded(const char *filename) const = 0; diff --git a/core/meta/src/TClass.cxx b/core/meta/src/TClass.cxx index 9efeb3c31f52b..d962b61e856f1 100644 --- a/core/meta/src/TClass.cxx +++ b/core/meta/src/TClass.cxx @@ -3159,11 +3159,11 @@ void TClass::GetMenuItems(TList *list) } } -std::set TClass::GetMissingClassDictionaries() +std::set TClass::GetMissingClassDictionaries(bool recurse) { //Get the classes that have a missing dictionary. - std::set clMissingDict = gInterpreter->GetMissingDictionaries(this); + std::set clMissingDict = gInterpreter->GetMissingDictionaries(this, recurse); return clMissingDict; } diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index c844bbe01b261..ffcf6b8a1b8ba 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2754,8 +2754,8 @@ const char* TCling::GetInterpreterTypeName(const char* name, Bool_t full) } //______________________________________________________________________________ -namespace { - void GetMissingDictionariesForDecl(const clang::Decl* D, std::set &netD) +namespace UNNAMED { + void GetMissingDictionariesForDecl(const clang::Decl* D, std::set &netD, bool recurse) { // Get the data members that do not have a dictionary for a Decl. @@ -2764,24 +2764,31 @@ namespace { // If there is no RecordDecl there is no Dictionary if (!RD) return; - // Get the name of the class. - std::string name = dyn_cast(RD)->getQualifiedNameAsString(); + // Get the name of the class + std::string buf; + if (const NamedDecl* ND = llvm::dyn_cast(RD)) { + PrintingPolicy Policy(ND->getASTContext().getPrintingPolicy()); + llvm::raw_string_ostream stream(buf); + ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/true); + } + const char* name = buf.c_str(); + // Check for the dictionary of the curent class. - if (!gClassTable->GetDict(name.c_str())){ + if (!gClassTable->GetDict(name)){ netD.insert(D); - return ; + if(!recurse) return ; } // Recurse for the data members. for (clang::RecordDecl::decl_iterator RDI = RD->decls_begin() , RDE = RD->decls_end(); RDI != RDE; ++RDI) { - GetMissingDictionariesForDecl(*RDI, netD); + GetMissingDictionariesForDecl(*RDI, netD, recurse); } return ; } } //______________________________________________________________________________ -std::set TCling::GetMissingDictionaries(TClass* cl) +std::set TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recurse*/) { // Get the Tclass-s that do not have a dictionary. @@ -2792,14 +2799,34 @@ std::set TCling::GetMissingDictionaries(TClass* cl) // Get the Decls recursively for all data members of TClass cl std::set netD; - GetMissingDictionariesForDecl(D, netD); + UNNAMED::GetMissingDictionariesForDecl(D, netD, recurse); + + std::set classesMissingDict; //convert set to set + for (std::set::const_iterator I = netD.begin(), + E = netD.end(); I != E; ++I) { + // Get name of the class. + std::string buf; + if (const NamedDecl* ND = llvm::dyn_cast(*I)) { + PrintingPolicy Policy(ND->getASTContext().getPrintingPolicy()); + llvm::raw_string_ostream stream(buf); + ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/true); + } + const char* name = buf.c_str(); + if (TClass* clMissingDict = TClass::GetClass(name)) { + classesMissingDict.insert(clMissingDict); + } else { + Error("TCling::GetMissingDictionaries", "The class %s missing dictionary was not found.", name); + } + } //return the classes the have missing dictionaries - std::set clMissingDict; - if (netD.empty()) clMissingDict.insert(0); - return clMissingDict; + + if (netD.empty()) { + classesMissingDict.insert(0); + } + return classesMissingDict; } //______________________________________________________________________________ diff --git a/core/meta/src/TCling.h b/core/meta/src/TCling.h index c93eef84ec86d..218feab0e21b7 100644 --- a/core/meta/src/TCling.h +++ b/core/meta/src/TCling.h @@ -137,8 +137,8 @@ class TCling : public TInterpreter { const char* GetIncludePath(); virtual const char* GetSTLIncludePath() const; TObjArray* GetRootMapFiles() const { return fRootmapFiles; } - void GetMissingDictionariesForDecl(const clang::Decl* D, std::set netD); - std::set GetMissingDictionaries(TClass* cl); + void GetMissingDictionariesForDecl(const clang::Decl* D, std::set netD, bool recurse); + std::set GetMissingDictionaries(TClass* cl, bool recurse); virtual void Initialize(); void InspectMembers(TMemberInspector&, void* obj, const TClass* cl); Bool_t IsLoaded(const char* filename) const; From 7ac3dff960d37ead7f655c2927bdfe2691423196 Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Wed, 14 Aug 2013 17:50:57 +0200 Subject: [PATCH 3/6] HasDictionary with recursive flag. --- core/meta/src/TCling.cxx | 66 +++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index ffcf6b8a1b8ba..1c6574b727d60 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2759,31 +2759,66 @@ namespace UNNAMED { { // Get the data members that do not have a dictionary for a Decl. - // Convert to RecordDecl. - const clang::RecordDecl* RD = dyn_cast(D); - // If there is no RecordDecl there is no Dictionary - if (!RD) return; - // Get the name of the class std::string buf; - if (const NamedDecl* ND = llvm::dyn_cast(RD)) { + if (const NamedDecl* ND = llvm::dyn_cast(D)) { PrintingPolicy Policy(ND->getASTContext().getPrintingPolicy()); llvm::raw_string_ostream stream(buf); - ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/true); + ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/false); } const char* name = buf.c_str(); // Check for the dictionary of the curent class. if (!gClassTable->GetDict(name)){ - netD.insert(D); + std::set::iterator it = netD.find(D); + if (it != netD.end()) return ; + netD.insert(D); if(!recurse) return ; } - // Recurse for the data members. - for (clang::RecordDecl::decl_iterator RDI = RD->decls_begin() - , RDE = RD->decls_end(); RDI != RDE; ++RDI) { - GetMissingDictionariesForDecl(*RDI, netD, recurse); - } + else return ; + if (const clang::CXXRecordDecl* RD = llvm::dyn_cast(D)) { + // Recurse for the data members. + for (clang::RecordDecl::field_iterator iField = RD->field_begin(), + eField = RD->field_end(); iField != eField; ++iField) { + + clang::QualType qualType = (*iField)->getType(); + if (!qualType.isNull()) { + + //class + if (qualType->isRecordType()) { + if(clang::CXXRecordDecl* FD = qualType->getAsCXXRecordDecl()) { + GetMissingDictionariesForDecl(FD, netD, recurse); + } + } + //pointer to class or to array or reference + if (qualType->isPointerType() || qualType->isReferenceType()) { + QualType pointeeType = qualType->getPointeeType(); + if (pointeeType->isRecordType()) { + if(clang::CXXRecordDecl* FD = pointeeType->getAsCXXRecordDecl()) { + GetMissingDictionariesForDecl(FD, netD, recurse); + } + } + else if(pointeeType->isArrayType()) { + const Type* elementType = qualType->getArrayElementTypeNoTypeQual(); + if (elementType->isRecordType()) { + if(clang::CXXRecordDecl* FD = elementType->getAsCXXRecordDecl()) { + GetMissingDictionariesForDecl(FD, netD, recurse); + } + } + } + } + //array of class elements + if (qualType->isArrayType()) { + const Type* elementType = qualType->getArrayElementTypeNoTypeQual(); + if (elementType->isRecordType()) { + clang::CXXRecordDecl* FD = elementType->getAsCXXRecordDecl(); + GetMissingDictionariesForDecl(FD, netD, recurse); + } + } + } + } + } return ; } } @@ -2799,7 +2834,10 @@ std::set TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recu // Get the Decls recursively for all data members of TClass cl std::set netD; - UNNAMED::GetMissingDictionariesForDecl(D, netD, recurse); + // Convert to RecordDecl. + if (const clang::RecordDecl* RD = llvm::dyn_cast(D)) { + UNNAMED::GetMissingDictionariesForDecl(RD, netD, recurse); + } std::set classesMissingDict; From 52680c946cbcf7c4da0bb0780e39615acdd085fd Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Thu, 15 Aug 2013 16:26:25 +0200 Subject: [PATCH 4/6] Added comment. --- core/meta/src/TCling.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index 1c6574b727d60..590036e287b97 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2785,6 +2785,7 @@ namespace UNNAMED { clang::QualType qualType = (*iField)->getType(); if (!qualType.isNull()) { + //Repetion of code will be fixed with next commit. //class if (qualType->isRecordType()) { if(clang::CXXRecordDecl* FD = qualType->getAsCXXRecordDecl()) { From 3c1eef09e91fa73ba13151a5f071da4e1b947e2f Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Fri, 16 Aug 2013 14:17:47 +0200 Subject: [PATCH 5/6] Fix recursion for pointer to array in GetMissingDictionaries. --- core/meta/src/TCling.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index 590036e287b97..9df5a7b8439ce 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2801,7 +2801,8 @@ namespace UNNAMED { } } else if(pointeeType->isArrayType()) { - const Type* elementType = qualType->getArrayElementTypeNoTypeQual(); + clang::CXXRecordDecl* FD = pointeeType->getAsCXXRecordDecl(); + const Type* elementType = pointeeType->getArrayElementTypeNoTypeQual(); if (elementType->isRecordType()) { if(clang::CXXRecordDecl* FD = elementType->getAsCXXRecordDecl()) { GetMissingDictionariesForDecl(FD, netD, recurse); From d8fd16610ec0b4b356d7de311e41875c5d640ee7 Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Tue, 20 Aug 2013 17:30:28 +0200 Subject: [PATCH 6/6] Fix semantics and the return structure of the classes with no dictionary. --- core/meta/inc/TClass.h | 3 +- core/meta/inc/TInterpreter.h | 3 +- core/meta/src/TClass.cxx | 14 ++++-- core/meta/src/TCling.cxx | 84 ++++++++++++++++++++++++++---------- core/meta/src/TCling.h | 4 +- 5 files changed, 78 insertions(+), 30 deletions(-) diff --git a/core/meta/inc/TClass.h b/core/meta/inc/TClass.h index 3a7237c218d01..797f66c1d6105 100644 --- a/core/meta/inc/TClass.h +++ b/core/meta/inc/TClass.h @@ -310,7 +310,8 @@ friend class ROOT::TGenericClassInfo; TVirtualStreamerInfo *GetStreamerInfo(Int_t version=0) const; TVirtualStreamerInfo *GetStreamerInfoAbstractEmulated(Int_t version=0) const; const type_info *GetTypeInfo() const { return fTypeInfo; }; - std::set GetMissingClassDictionaries(bool recurse); + Bool_t HasDictionary() const; + void GetMissingDictionaries(bool recurse, TObjArray& result); void IgnoreTObjectStreamer(Bool_t ignore=kTRUE); Bool_t InheritsFrom(const char *cl) const; Bool_t InheritsFrom(const TClass *cl) const; diff --git a/core/meta/inc/TInterpreter.h b/core/meta/inc/TInterpreter.h index da0e18e36a16c..0adf1f25a1476 100644 --- a/core/meta/inc/TInterpreter.h +++ b/core/meta/inc/TInterpreter.h @@ -75,7 +75,8 @@ class TInterpreter : public TNamed { virtual const char *GetIncludePath() = 0; virtual const char *GetSTLIncludePath() const { return ""; } virtual TObjArray *GetRootMapFiles() const = 0; - virtual std::set GetMissingDictionaries(TClass* cl, bool recurse) = 0; + virtual Bool_t HasDictionary(TClass* cl) const = 0; + virtual void GetMissingDictionaries(TClass* cl, bool recurse, TObjArray& result) = 0; virtual void Initialize() = 0; virtual void InspectMembers(TMemberInspector&, void* obj, const TClass* cl) = 0; virtual Bool_t IsLoaded(const char *filename) const = 0; diff --git a/core/meta/src/TClass.cxx b/core/meta/src/TClass.cxx index d962b61e856f1..f7e9893c21bfe 100644 --- a/core/meta/src/TClass.cxx +++ b/core/meta/src/TClass.cxx @@ -3159,12 +3159,18 @@ void TClass::GetMenuItems(TList *list) } } -std::set TClass::GetMissingClassDictionaries(bool recurse) +Bool_t TClass::HasDictionary() const { - //Get the classes that have a missing dictionary. + // Check whether a class has a dictionary or not. - std::set clMissingDict = gInterpreter->GetMissingDictionaries(this, recurse); - return clMissingDict; + return gInterpreter->HasDictionary(this); +} + +void TClass::GetMissingDictionaries(bool recurse, TObjArray& result) +{ + // Get the classes that have a missing dictionary. + + gInterpreter->GetMissingDictionaries(this, recurse, result); } //______________________________________________________________________________ diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index 9df5a7b8439ce..401ce04006d47 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -2754,7 +2754,36 @@ const char* TCling::GetInterpreterTypeName(const char* name, Bool_t full) } //______________________________________________________________________________ -namespace UNNAMED { +Bool_t TCling::HasDictionary(TClass* cl) const +{ + // Check whether a class has a dictionary or not. + + // Get the Decl for the class. + TClingClassInfo* cli = (TClingClassInfo*)cl->GetClassInfo(); + const clang::Decl* D = cli->GetDecl(); + + // Convert to RecordDecl. + if (const clang::RecordDecl* RD = llvm::dyn_cast(D)) { + + // Get the name of the class + std::string buf; + if (const NamedDecl* ND = llvm::dyn_cast(RD)) { + PrintingPolicy Policy(ND->getASTContext().getPrintingPolicy()); + llvm::raw_string_ostream stream(buf); + ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/false); + } + const char* name = buf.c_str(); + + // Check for the dictionary of the curent class. + if (gClassTable->GetDict(name)) + return true; + } + return false; +} + +//______________________________________________________________________________ +namespace { + void GetMissingDictionariesForDataMembers(const clang::Decl* D, std::set &netD, bool recurse); void GetMissingDictionariesForDecl(const clang::Decl* D, std::set &netD, bool recurse) { // Get the data members that do not have a dictionary for a Decl. @@ -2773,9 +2802,14 @@ namespace UNNAMED { std::set::iterator it = netD.find(D); if (it != netD.end()) return ; netD.insert(D); - if(!recurse) return ; } - else return ; + if (recurse) { + GetMissingDictionariesForDataMembers(D, netD, recurse); + } + return ; + } + + void GetMissingDictionariesForDataMembers(const clang::Decl* D, std::set &netD, bool recurse) { if (const clang::CXXRecordDecl* RD = llvm::dyn_cast(D)) { // Recurse for the data members. @@ -2801,12 +2835,11 @@ namespace UNNAMED { } } else if(pointeeType->isArrayType()) { - clang::CXXRecordDecl* FD = pointeeType->getAsCXXRecordDecl(); const Type* elementType = pointeeType->getArrayElementTypeNoTypeQual(); if (elementType->isRecordType()) { if(clang::CXXRecordDecl* FD = elementType->getAsCXXRecordDecl()) { - GetMissingDictionariesForDecl(FD, netD, recurse); - } + GetMissingDictionariesForDecl(FD, netD, recurse); + } } } } @@ -2819,13 +2852,12 @@ namespace UNNAMED { } } } - } - } - return ; + } + } } } //______________________________________________________________________________ -std::set TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recurse*/) +void TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recurse*/, TObjArray& result) { // Get the Tclass-s that do not have a dictionary. @@ -2838,12 +2870,27 @@ std::set TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recu std::set netD; // Convert to RecordDecl. if (const clang::RecordDecl* RD = llvm::dyn_cast(D)) { - UNNAMED::GetMissingDictionariesForDecl(RD, netD, recurse); - } - std::set classesMissingDict; + // Get the name of the class + std::string buf; + if (const NamedDecl* ND = llvm::dyn_cast(D)) { + PrintingPolicy Policy(ND->getASTContext().getPrintingPolicy()); + llvm::raw_string_ostream stream(buf); + ND->getNameForDiagnostic(stream, Policy, /*Qualified=*/false); + } + const char* name = buf.c_str(); + + // Check for the dictionary of the curent class. + if (!gClassTable->GetDict(name)){ + std::set::iterator it = netD.find(D); + if (it == netD.end()) + netD.insert(D); + } + + GetMissingDictionariesForDataMembers(D, netD, recurse); + } - //convert set to set + //convert set to TObjArray for (std::set::const_iterator I = netD.begin(), E = netD.end(); I != E; ++I) { // Get name of the class. @@ -2855,18 +2902,11 @@ std::set TCling::GetMissingDictionaries(TClass* cl, bool recurse /*recu } const char* name = buf.c_str(); if (TClass* clMissingDict = TClass::GetClass(name)) { - classesMissingDict.insert(clMissingDict); + result.Add(clMissingDict); } else { Error("TCling::GetMissingDictionaries", "The class %s missing dictionary was not found.", name); } } - - //return the classes the have missing dictionaries - - if (netD.empty()) { - classesMissingDict.insert(0); - } - return classesMissingDict; } //______________________________________________________________________________ diff --git a/core/meta/src/TCling.h b/core/meta/src/TCling.h index 218feab0e21b7..908d2b3283d17 100644 --- a/core/meta/src/TCling.h +++ b/core/meta/src/TCling.h @@ -137,8 +137,8 @@ class TCling : public TInterpreter { const char* GetIncludePath(); virtual const char* GetSTLIncludePath() const; TObjArray* GetRootMapFiles() const { return fRootmapFiles; } - void GetMissingDictionariesForDecl(const clang::Decl* D, std::set netD, bool recurse); - std::set GetMissingDictionaries(TClass* cl, bool recurse); + Bool_t HasDictionary(TClass* cl) const; + void GetMissingDictionaries(TClass* cl, bool recurse, TObjArray& result); virtual void Initialize(); void InspectMembers(TMemberInspector&, void* obj, const TClass* cl); Bool_t IsLoaded(const char* filename) const;