12 #include "RConfigure.h" 22 #include "clang/AST/Decl.h" 23 #include "clang/AST/DeclTemplate.h" 27 #include "cling/Interpreter/Interpreter.h" 28 #include "cling/Interpreter/LookupHelper.h" 30 #include "clang/Sema/Sema.h" 31 #include "clang/Sema/Template.h" 32 #include "clang/Frontend/CompilerInstance.h" 33 #include "clang/AST/DeclTemplate.h" 58 clang::QualType thisType =
type;
60 auto typePtr = thisType.getTypePtr();
61 const clang::CXXRecordDecl *stlclass = typePtr->getAsCXXRecordDecl();
68 if (typeForIO.getTypePtr() != typePtr)
69 stlclass = typeForIO->getAsCXXRecordDecl();
75 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
83 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
85 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
88 llvm::StringRef argname = decl->getName();
89 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
90 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
97 thisType.getTypePtr(),
110 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
111 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
113 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
117 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
119 if (!clxx->isCompleteDefinition()) {
123 GenerateTClassFor(arg.getAsType(),interp,normCtxt);
133 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
135 if (templateCl == 0) {
142 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
144 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
147 llvm::StringRef argname = decl->getName();
148 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
149 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
158 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
159 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
161 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
165 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
167 if (!clxx->isCompleteDefinition()) {
169 clxx = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
172 GenerateTClassFor( splitType.
fElements[i+1].c_str(), clxx, interp, normCtxt);
174 GenerateTClassFor(
"", clxx, interp, normCtxt );
186 fprintf(stderr,
"ROOT::Internal::RStl singleton\n");
187 list_t::iterator iter;
188 for(iter = fList.begin(); iter != fList.end(); ++iter) {
194 const cling::Interpreter &interp,
197 bool &needCollectionProxy,
198 void (*emitStreamerInfo)(
const char*) )
204 list_t::iterator iter;
205 for(iter = fList.begin(); iter != fList.end(); ++iter) {
206 const clang::CXXRecordDecl*
result;
208 if (!iter->GetRecordDecl()->getDefinition()) {
212 const cling::LookupHelper& lh = interp.getLookupHelper();
213 result = llvm::dyn_cast_or_null<clang::CXXRecordDecl>(lh.findScope(iter->GetNormalizedName(),
214 cling::LookupHelper::NoDiagnostics,
218 if (!result || !iter->GetRecordDecl()->getDefinition()) {
219 fprintf(stderr,
"Error: incomplete definition for %s\n",iter->GetNormalizedName());
225 result = llvm::dyn_cast<clang::CXXRecordDecl>(iter->GetRecordDecl());
231 if (emitStreamerInfo) emitStreamerInfo(iter->GetNormalizedName());
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
std::vector< std::string > fElements
Type
enumeration specifying the integration types.
void GenerateTClassFor(const char *requestedName, const clang::CXXRecordDecl *stlClass, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt)
void WriteClassInit(std::ostream &strm, const cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, const ROOT::TMetaUtils::RConstructorTypes &, bool &needCollectionProxy, void(*emitStreamerInfo)(const char *))