Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TClingMethodArgInfo.h
Go to the documentation of this file.
1// @(#)root/core/meta:$Id$
2// Author: Paul Russo 30/07/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TClingMethodArgInfo
13#define ROOT_TClingMethodArgInfo
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TClingMethodArgInfo //
18// //
19// Emulation of the CINT MethodInfo class. //
20// //
21// The CINT C++ interpreter provides an interface to metadata about //
22// the arguments to a function through the MethodArgInfo class. This //
23// class provides the same functionality, using an interface as close //
24// as possible to MethodArgInfo but the typedef metadata comes from //
25// the Clang C++ compiler, not CINT. //
26// //
27//////////////////////////////////////////////////////////////////////////
28
29#include "TClingDeclInfo.h"
30
31#include "clang/AST/Decl.h"
32
33namespace clang {
34 class ParmVarDecl;
35}
36
37namespace cling {
38 class Interpreter;
39}
40
42class TClingTypeInfo;
43
44class TClingMethodArgInfo final : public TClingDeclInfo {
45
46private:
47
48 cling::Interpreter *fInterp; // Cling interpreter, we do *not* own.
49 int fIdx; // Iterator, current parameter index.
50
51public:
52
53 explicit TClingMethodArgInfo(cling::Interpreter *interp) : TClingDeclInfo(nullptr), fInterp(interp), fIdx(-1) {}
54 TClingMethodArgInfo(cling::Interpreter *interp, const TClingMethodInfo *mi);
55
56 // Add a covariant return type for handy use.
57 const clang::ParmVarDecl* GetDecl() const override {
58 if (const auto FD = llvm::cast_or_null<clang::FunctionDecl>(TClingDeclInfo::GetDecl()))
59 return FD->getParamDecl(fIdx);
60 return nullptr;
61 }
62 bool IsValid() const override;
63 int Next();
64 long Property() const;
65 const char *DefaultValue() const;
66 const TClingTypeInfo *Type() const;
67 const char *TypeName() const;
68
69};
70
71#endif // ROOT_TClingMethodArgInfo
The file contains a base class of TCling*Info classes.
virtual const clang::Decl * GetDecl() const
Emulation of the CINT MethodInfo class.
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.