29#include "cling/Interpreter/Interpreter.h"
30#include "clang/AST/ASTContext.h"
31#include "clang/AST/Decl.h"
32#include "clang/AST/Expr.h"
33#include "clang/AST/ExprCXX.h"
34#include "clang/AST/PrettyPrinter.h"
35#include "clang/AST/Type.h"
36#include "clang/Sema/Sema.h"
38#include "llvm/Support/Casting.h"
39#include "llvm/Support/raw_ostream.h"
54 int numParams =
static_cast<int>(FD->getNumParams());
55 return (
fIdx > -1) && (
fIdx < numParams);
71 const clang::ParmVarDecl *pvd =
GetDecl();
72 if (pvd->hasDefaultArg() || pvd->hasInheritedDefaultArg()) {
75 clang::QualType qt = pvd->getOriginalType().getCanonicalType();
85 const clang::ParmVarDecl *pvd =
GetDecl();
87 if (pvd->hasUninstantiatedDefaultArg()) {
89 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
91 fInterp->getSema().BuildCXXDefaultArgExpr(clang::SourceLocation(),
92 const_cast<clang::FunctionDecl*
>(fd),
93 const_cast<clang::ParmVarDecl*
>(pvd));
95 const clang::Expr *expr = 0;
96 if (pvd->hasUninstantiatedDefaultArg()) {
98 expr = pvd->getUninstantiatedDefaultArg();
100 expr = pvd->getDefaultArg();
102 clang::ASTContext &context = pvd->getASTContext();
103 clang::PrintingPolicy policy(context.getPrintingPolicy());
104 TTHREAD_TLS_DECL( std::string, buf );
106 llvm::raw_string_ostream out(buf);
111 bool implicitInit =
false;
112 if (
const clang::CXXConstructExpr *construct =
113 llvm::dyn_cast<clang::CXXConstructExpr>(expr)) {
114 implicitInit = (pvd->getInitStyle() == clang::VarDecl::CallInit) &&
115 (construct->getNumArgs() == 0) &&
116 !construct->isListInitialization();
119 if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
122 else if (pvd->getInitStyle() == clang::VarDecl::CInit) {
125 expr->printPretty(out, 0, policy, 0);
126 if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
140 const clang::ParmVarDecl *pvd =
GetDecl();
141 clang::QualType qt = pvd->getOriginalType();
const clang::Decl * fDecl
long Property(long property, clang::QualType &qt) const
virtual const clang::Decl * GetDecl() const
bool IsValid() const override
TClingMethodArgInfo(cling::Interpreter *interp)
cling::Interpreter * fInterp
const clang::ParmVarDecl * GetDecl() const override
const char * DefaultValue() const
const TClingTypeInfo * Type() const
const char * TypeName() const
Emulation of the CINT MethodInfo class.
Emulation of the CINT TypeInfo class.
const char * Name() const override