12#include "RConfigure.h"
22#include "clang/AST/Decl.h"
23#include "clang/AST/DeclTemplate.h"
25#include "cling/Interpreter/Interpreter.h"
26#include "cling/Interpreter/LookupHelper.h"
28#include "clang/Sema/Sema.h"
29#include "clang/Sema/Template.h"
30#include "clang/Frontend/CompilerInstance.h"
53 clang::QualType thisType =
type;
55 auto typePtr = thisType.getTypePtr();
56 const clang::CXXRecordDecl *stlclass = typePtr->getAsCXXRecordDecl();
63 if (typeForIO.getTypePtr() != typePtr)
64 stlclass = typeForIO->getAsCXXRecordDecl();
70 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
78 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
79 if (arg.getKind() == clang::TemplateArgument::Type) {
80 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
83 llvm::StringRef argname = decl->getName();
84 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
85 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
92 thisType.getTypePtr(),
105 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
106 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
107 if (arg.getKind() == clang::TemplateArgument::Type) {
108 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
112 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
114 if (!clxx->isCompleteDefinition()) {
118 GenerateTClassFor(arg.getAsType(),interp,normCtxt);
128 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
130 if (templateCl == 0) {
137 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
138 if (arg.getKind() == clang::TemplateArgument::Type) {
139 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
142 llvm::StringRef argname = decl->getName();
143 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
144 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
153 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
154 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
155 if (arg.getKind() == clang::TemplateArgument::Type) {
156 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
160 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
162 if (!clxx->isCompleteDefinition()) {
164 clxx = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
167 GenerateTClassFor( splitType.
fElements[i+1].c_str(), clxx, interp, normCtxt);
169 GenerateTClassFor(
"", clxx, interp, normCtxt );
181 fprintf(stderr,
"ROOT::Internal::RStl singleton\n");
182 list_t::iterator iter;
183 for(iter = fList.begin(); iter != fList.end(); ++iter) {
189 const cling::Interpreter &interp,
192 bool &needCollectionProxy,
193 void (*emitStreamerInfo)(
const char*) )
199 list_t::iterator iter;
200 for(iter = fList.begin(); iter != fList.end(); ++iter) {
201 const clang::CXXRecordDecl* result;
203 if (!iter->GetRecordDecl()->getDefinition()) {
207 const cling::LookupHelper& lh = interp.getLookupHelper();
208 result = llvm::dyn_cast_or_null<clang::CXXRecordDecl>(lh.findScope(iter->GetNormalizedName(),
209 cling::LookupHelper::NoDiagnostics,
213 if (!result || !iter->GetRecordDecl()->getDefinition()) {
214 fprintf(stderr,
"Error: incomplete definition for %s\n",iter->GetNormalizedName());
220 result = llvm::dyn_cast<clang::CXXRecordDecl>(iter->GetRecordDecl());
226 if (emitStreamerInfo) emitStreamerInfo(iter->GetNormalizedName());
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 *))
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
std::vector< std::string > fElements