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);
79 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
80 if (arg.getKind() == clang::TemplateArgument::Type) {
81 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
84 llvm::StringRef argname = decl->getName();
85 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
86 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
93 thisType.getTypePtr(),
106 for(
unsigned int i=0; i < templateCl->getTemplateArgs().
size(); ++i) {
107 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
108 if (arg.getKind() == clang::TemplateArgument::Type) {
109 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
113 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
115 if (!clxx->isCompleteDefinition()) {
119 GenerateTClassFor(arg.getAsType(),interp,normCtxt);
129 const clang::ClassTemplateSpecializationDecl *templateCl = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(stlclass);
139 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(0) );
140 if (arg.getKind() == clang::TemplateArgument::Type) {
141 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
144 llvm::StringRef argname = decl->getName();
145 if ( (argname.str() ==
"bool") || (argname.str() ==
"Bool_t") ) {
146 ROOT::TMetaUtils::Warning(
"std::vector<bool>",
" is not fully supported yet!\nUse std::vector<char> or std::deque<bool> instead.\n");
155 for(
unsigned int i=0; i < templateCl->getTemplateArgs().
size(); ++i) {
156 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
157 if (arg.getKind() == clang::TemplateArgument::Type) {
158 const clang::NamedDecl *decl = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
162 const clang::CXXRecordDecl *clxx = llvm::dyn_cast<clang::CXXRecordDecl>(decl);
164 if (!clxx->isCompleteDefinition()) {
166 clxx = arg.getAsType().getTypePtr()->getAsCXXRecordDecl();
169 GenerateTClassFor( splitType.
fElements[i+1].c_str(), clxx, interp, normCtxt);
171 GenerateTClassFor(
"", clxx, interp, normCtxt );
183 fprintf(stderr,
"ROOT::Internal::RStl singleton\n");
184 list_t::iterator iter;
185 for(iter = fList.begin(); iter != fList.end(); ++iter) {
191 const cling::Interpreter &interp,
194 bool &needCollectionProxy,
195 void (*emitStreamerInfo)(
const char*) )
201 list_t::iterator iter;
202 for(iter = fList.begin(); iter != fList.end(); ++iter) {
203 const clang::CXXRecordDecl*
result;
205 if (!iter->GetRecordDecl()->getDefinition()) {
209 const cling::LookupHelper& lh = interp.getLookupHelper();
210 result = llvm::dyn_cast_or_null<clang::CXXRecordDecl>(lh.findScope(iter->GetNormalizedName(),
211 cling::LookupHelper::NoDiagnostics,
215 if (!
result || !iter->GetRecordDecl()->getDefinition()) {
216 fprintf(stderr,
"Error: incomplete definition for %s\n",iter->GetNormalizedName());
222 result = llvm::dyn_cast<clang::CXXRecordDecl>(iter->GetRecordDecl());
228 if (emitStreamerInfo) emitStreamerInfo(iter->GetNormalizedName());
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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