12 #include "RConfigure.h"
18 using namespace TClassEdit;
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"
60 const clang::CXXRecordDecl *stlclass = type.getTypePtr()->getAsCXXRecordDecl();
64 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
66 if (templateCl == 0) {
72 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
74 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
77 llvm::StringRef argname = decl->getName();
78 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
79 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
85 fList.insert(
ROOT::TMetaUtils::AnnotatedRecordDecl(++
fgCount,type.getTypePtr(),stlclass,
"",
false ,
false,
false,
false,-1, interp, normCtxt) );
89 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
90 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
92 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
96 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
98 if (!clxx->isCompleteDefinition()) {
102 GenerateTClassFor(arg.getAsType(),interp,normCtxt);
113 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
115 if (templateCl == 0) {
122 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
124 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
127 llvm::StringRef argname = decl->getName();
128 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
129 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
138 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
139 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
141 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
145 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
147 if (!clxx->isCompleteDefinition()) {
149 clxx = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
152 GenerateTClassFor( splitType.
fElements[i+1].c_str(), clxx, interp, normCtxt);
154 GenerateTClassFor(
"", clxx, interp, normCtxt );
167 fprintf(stderr,
"ROOT::Internal::RStl singleton\n");
168 list_t::iterator
iter;
169 for(iter = fList.begin(); iter != fList.end(); ++
iter) {
175 const cling::Interpreter &interp,
178 bool &needCollectionProxy,
179 void (*emitStreamerInfo)(
const char*) )
185 list_t::iterator
iter;
186 for(iter = fList.begin(); iter != fList.end(); ++
iter) {
187 const clang::CXXRecordDecl*
result;
189 if (!iter->GetRecordDecl()->getDefinition()) {
193 const cling::LookupHelper& lh = interp.getLookupHelper();
194 result = llvm::dyn_cast_or_null<clang::CXXRecordDecl>(lh.findScope(iter->GetNormalizedName(),
195 cling::LookupHelper::NoDiagnostics,
199 if (!result || !iter->GetRecordDecl()->getDefinition()) {
200 fprintf(stderr,
"Error: incomplete definition for %s\n",iter->GetNormalizedName());
206 result = llvm::dyn_cast<clang::CXXRecordDecl>(iter->GetRecordDecl());
215 if (emitStreamerInfo) emitStreamerInfo(iter->GetNormalizedName());
std::map< std::string, std::string >::const_iterator iter
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 *))