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" 49 return (
fIdx > -1) && (
fIdx < numParams);
65 const clang::ParmVarDecl *pvd = fd->getParamDecl(
fIdx);
66 if (pvd->hasDefaultArg() || pvd->hasInheritedDefaultArg()) {
69 clang::QualType qt = pvd->getOriginalType().getCanonicalType();
70 if (qt.isConstQualified()) {
74 if (qt->isArrayType()) {
75 qt = llvm::cast<clang::ArrayType>(qt)->getElementType();
78 else if (qt->isReferenceType()) {
80 qt = llvm::cast<clang::ReferenceType>(qt)->getPointeeType();
83 else if (qt->isPointerType()) {
85 if (qt.isConstQualified()) {
88 qt = llvm::cast<clang::PointerType>(qt)->getPointeeType();
91 else if (qt->isMemberPointerType()) {
92 qt = llvm::cast<clang::MemberPointerType>(qt)->getPointeeType();
97 if (qt.isConstQualified()) {
109 const clang::ParmVarDecl *pvd = fd->getParamDecl(
fIdx);
111 if (pvd->hasUninstantiatedDefaultArg()) {
113 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
115 fInterp->getSema().BuildCXXDefaultArgExpr(clang::SourceLocation(),
116 const_cast<clang::FunctionDecl*>(fd),
117 const_cast<clang::ParmVarDecl*>(pvd));
119 const clang::Expr *expr = 0;
120 if (pvd->hasUninstantiatedDefaultArg()) {
122 expr = pvd->getUninstantiatedDefaultArg();
124 expr = pvd->getDefaultArg();
126 clang::ASTContext &context = pvd->getASTContext();
127 clang::PrintingPolicy policy(context.getPrintingPolicy());
128 TTHREAD_TLS_DECL( std::string, buf );
130 llvm::raw_string_ostream out(buf);
135 bool implicitInit =
false;
136 if (
const clang::CXXConstructExpr *construct =
137 llvm::dyn_cast<clang::CXXConstructExpr>(expr)) {
138 implicitInit = (pvd->getInitStyle() == clang::VarDecl::CallInit) &&
139 (construct->getNumArgs() == 0) &&
140 !construct->isListInitialization();
143 if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
146 else if (pvd->getInitStyle() == clang::VarDecl::CInit) {
149 expr->printPretty(out, 0, policy, 0);
150 if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
164 const clang::ParmVarDecl *pvd = fd->getParamDecl(
fIdx);
165 TTHREAD_TLS_DECL( std::string, buf);
167 clang::PrintingPolicy policy(pvd->getASTContext().getPrintingPolicy());
168 llvm::raw_string_ostream stream(buf);
169 pvd->getNameForDiagnostic(stream, policy,
true);
181 const clang::ParmVarDecl *pvd = fd->getParamDecl(
fIdx);
182 clang::QualType qt = pvd->getOriginalType();
const TClingTypeInfo * Type() const
RooArgList L(const RooAbsArg &v1)
const char * Name() const
const char * DefaultValue() const
const TClingMethodInfo * fMethodInfo
Emulation of the CINT TypeInfo class.
const clang::FunctionDecl * GetMethodDecl() const
const char * TypeName() const
cling::Interpreter * fInterp
const char * Name() const