35#include "cling/Interpreter/Value.h"
37#include "clang/AST/ASTContext.h"
38#include "llvm/ADT/SmallVector.h"
67 std::unique_ptr<TClingMethodInfo>
fMethod;
69 const clang::FunctionDecl *
fDecl =
nullptr;
73 std::atomic<tcling_callfunc_Wrapper_t>
fWrapper;
75 mutable llvm::SmallVector<cling::Value, 8>
fArgVals;
87 const std::string& wrapper,
88 bool withAccessControl =
true);
91 std::ostringstream& callbuf, std::string& type_name,
95 void make_narg_call(
const std::string &return_type,
const unsigned N, std::ostringstream &typedefbuf,
96 std::ostringstream &callbuf,
const std::string &class_name,
int indent_level);
99 std::ostringstream& callbuf,
100 const std::string& class_name,
int indent_level);
103 const std::string& class_name,
104 std::ostringstream& buf,
int indent_level);
107 const std::string& class_name,
108 std::ostringstream& buf,
int indent_level);
118 void exec(
void* address,
void* ret);
133 template <
typename T>
134 T
ExecT(
void* address);
164 const std::string &type_name,
165 void* address =
nullptr,
unsigned long nary = 0UL);
167 unsigned long nary = 0UL,
bool withFree =
true);
170 const void* args[] = 0,
181 void Init(std::unique_ptr<TClingMethodInfo>);
199 return fMethod->GetTargetFunctionDecl();
205 template<typename T, std::enable_if_t<std::is_fundamental<T>::value,
bool> =
true>
207 cling::Value ArgValue = cling::Value::Create(*
fInterp, arg);
212 if (
const clang::FunctionDecl* FD =
GetDecl()) {
215 if (!llvm::isa<clang::CXXMethodDecl>(FD)) {
216 clang::QualType QT = FD->getParamDecl(
fArgVals.size())->getType();
217 QT = QT.getCanonicalType();
218 clang::ASTContext &C = FD->getASTContext();
219 if (QT->isBuiltinType() && !C.hasSameType(QT, ArgValue.getType())) {
220 switch(QT->getAs<clang::BuiltinType>()->getKind()) {
227#define X(type, name) \
228 case clang::BuiltinType::name: \
229 ArgValue = cling::Value::Create(*fInterp, (type)arg); \
231 CLING_VALUE_BUILTIN_TYPES
240 void SetArgs(
const char* args);
242 const char* arglist,
Longptr_t* poffset);
244 const char* arglist,
bool objectIsConst,
Longptr_t* poffset);
253 const llvm::SmallVectorImpl<clang::QualType>&
proto,
257 const llvm::SmallVectorImpl<clang::QualType>&
proto,
void(* tcling_callfunc_ctor_Wrapper_t)(void **, void *, unsigned long)
void(* tcling_callfunc_Wrapper_t)(void *, int, void **, void *)
void(* tcling_callfunc_dtor_Wrapper_t)(void *, unsigned long, int)
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 mode
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD_CLING(mutex)
Emulation of the CINT CallFunc class.
void * ExecDefaultConstructor(const TClingClassInfo *info, ROOT::TMetaUtils::EIOCtorCategory kind, const std::string &type_name, void *address=nullptr, unsigned long nary=0UL)
void ExecWithReturn(void *address, void *ret=nullptr)
void exec_with_valref_return(void *address, cling::Value &ret)
std::unique_ptr< TClingMethodInfo > fMethod
Current method, we own.
void collect_type_info(clang::QualType &QT, std::ostringstream &typedefbuf, std::ostringstream &callbuf, std::string &type_name, EReferenceType &refType, bool &isPointer, int indent_level, bool forArgument)
const clang::FunctionDecl * GetDecl() const
void SetArgs(const char *args)
size_t fMinRequiredArguments
Number of required arguments.
size_t CalculateMinRequiredArguments()
double ExecDouble(void *address)
void SetArgArray(Longptr_t *argArr, int narg)
tcling_callfunc_Wrapper_t make_wrapper()
tcling_callfunc_dtor_Wrapper_t make_dtor_wrapper(const TClingClassInfo *info)
TClingCallFunc(const TClingMethodInfo &minfo)
~TClingCallFunc()=default
std::function< void(void *address, cling::Value &ret)> ExecWithRetFunc_t
void ExecDestructor(const TClingClassInfo *info, void *address=nullptr, unsigned long nary=0UL, bool withFree=true)
Longptr_t ExecInt(void *address)
const clang::DeclContext * GetDeclContext() const
void * compile_wrapper(const std::string &wrapper_name, const std::string &wrapper, bool withAccessControl=true)
void SetFuncProto(const TClingClassInfo *info, const char *method, const char *proto, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
TClingCallFunc(cling::Interpreter *interp)
TInterpreter::CallFuncIFacePtr_t IFacePtr()
void exec(void *address, void *ret)
std::atomic< tcling_callfunc_Wrapper_t > fWrapper
Pointer to compiled wrapper, we do not own.
void Invoke(cling::Value *result=0) const
void make_narg_ctor(const unsigned N, std::ostringstream &typedefbuf, std::ostringstream &callbuf, const std::string &class_name, int indent_level)
void SetFunc(const TClingClassInfo *info, const char *method, const char *arglist, Longptr_t *poffset)
const clang::FunctionDecl * GetDecl()
void EvaluateArgList(const std::string &ArgList)
const clang::Decl * GetFunctionOrShadowDecl() const
void ExecWithArgsAndReturn(void *address, const void *args[]=0, int nargs=0, void *ret=0)
TClingCallFunc(const TClingCallFunc &rhs)
void Exec(void *address, TInterpreterValue *interpVal=0)
TClingMethodInfo * FactoryMethod() const
int get_wrapper_code(std::string &wrapper_name, std::string &wrapper)
size_t GetMinRequiredArguments()
tcling_callfunc_ctor_Wrapper_t make_ctor_wrapper(const TClingClassInfo *, ROOT::TMetaUtils::EIOCtorCategory, const std::string &)
void IgnoreExtraArgs(bool ignore)
TClingCallFunc & operator=(const TClingCallFunc &rhs)=delete
long long ExecInt64(void *address)
cling::Interpreter * fInterp
Cling interpreter, we do not own.
void make_narg_call(const std::string &return_type, const unsigned N, std::ostringstream &typedefbuf, std::ostringstream &callbuf, const std::string &class_name, int indent_level)
const clang::FunctionDecl * fDecl
Decl for the method.
void make_narg_call_with_return(const unsigned N, const std::string &class_name, std::ostringstream &buf, int indent_level)
llvm::SmallVector< cling::Value, 8 > fArgVals
Stored function arguments, we own.
void make_narg_ctor_with_return(const unsigned N, const std::string &class_name, std::ostringstream &buf, int indent_level)
Emulation of the CINT ClassInfo class.
Emulation of the CINT MethodInfo class.