30#include "cling/Interpreter/LookupHelper.h"
31#include "cling/Utils/AST.h"
32#include "clang/AST/Attr.h"
42 :
TClingDeclInfo(nullptr), fInterp(interp), fFirstTime(true), fDescend(false), fTitle(
"")
48 const clang::TypedefNameDecl *TdefD)
49 :
TClingDeclInfo(TdefD), fInterp(interp), fFirstTime(true), fDescend(false), fTitle(
"")
65 fIter = clang::DeclContext::decl_iterator();
70 const char lastChar =
name[strlen(
name) - 1];
71 if (lastChar ==
'*' || lastChar ==
'&' || !strncmp(
name,
"const ", 6))
75 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
76 clang::QualType QT = lh.findType(
name,
77 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
78 : cling::LookupHelper::NoDiagnostics);
83 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
84 : cling::LookupHelper::NoDiagnostics);
90 const clang::TypedefType *td = QT->getAs<clang::TypedefType>();
96 fDecl = td->getDecl();
110 clang::PrintingPolicy Policy(
fDecl->getASTContext().getPrintingPolicy());
111 llvm::raw_string_ostream stream(buf);
112 llvm::dyn_cast<clang::NamedDecl>(
fDecl)
113 ->getNameForDiagnostic(stream, Policy,
false);
115 Error(
"TClingTypedefInfo::InternalNext",
"Next called but iteration not prepared for %s!",buf.c_str());
120 cling::Interpreter::PushTransactionRAII pushedT(
fInterp);
140 clang::DeclContext *dc = llvm::cast<clang::DeclContext>(*
fIter);
141 fIter = dc->decls_begin();
157 if (llvm::isa<clang::TypedefNameDecl>(*
fIter)) {
162 clang::Decl::Kind dk =
fIter->getKind();
163 if ((dk == clang::Decl::Namespace) || (dk == clang::Decl::CXXRecord) ||
164 (dk == clang::Decl::ClassTemplateSpecialization)) {
188 const clang::TypedefNameDecl *td = llvm::dyn_cast<clang::TypedefNameDecl>(
fDecl);
189 clang::QualType qt = td->getUnderlyingType().getCanonicalType();
201 clang::ASTContext &context =
fDecl->getASTContext();
202 const clang::TypedefNameDecl *td = llvm::dyn_cast<clang::TypedefNameDecl>(
fDecl);
203 clang::QualType qt = td->getUnderlyingType();
204 if (qt->isDependentType()) {
209 if (
const clang::RecordType *rt = qt->getAs<clang::RecordType>()) {
210 if (!rt->getDecl()->getDefinition()) {
217 cling::Interpreter::PushTransactionRAII pushedT(
fInterp);
220 clang::CharUnits::QuantityType quantity =
221 context.getTypeSizeInChars(qt).getQuantity();
223 return static_cast<int>(quantity);
235 TTHREAD_TLS_DECL( std::string, truename);
237 const clang::TypedefNameDecl *td = llvm::dyn_cast<clang::TypedefNameDecl>(
fDecl);
238 clang::QualType underlyingType = td->getUnderlyingType();
239 if (underlyingType->isBooleanType()) {
242 const clang::ASTContext &ctxt =
fInterp->getCI()->getASTContext();
245 return truename.c_str();
259 const clang::TypedefNameDecl *td = llvm::cast<clang::TypedefNameDecl>(
fDecl);
260 const clang::ASTContext &ctxt = td->getASTContext();
280 if (
const TypedefNameDecl *TND = llvm::dyn_cast<TypedefNameDecl>(
GetDecl())) {
282 if (AnnotateAttr *
A = TND->getAttr<AnnotateAttr>()) {
283 fTitle =
A->getAnnotation().str();
288 else if (!
GetDecl()->isFromASTFile()) {
void Error(const char *location, const char *msgfmt,...)
const clang::Decl * fDecl
virtual bool IsValid() const
long Property(long property, clang::QualType &qt) const
virtual const clang::Decl * GetDecl() const
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Get the name of the underlying type of the current typedef.
long Property() const
Return a bit mask of metadata about the current typedef.
clang::DeclContext::decl_iterator fIter
TClingTypedefInfo(cling::Interpreter *interp)
const char * Name() const override
Get the name of the current typedef.
void Init(const char *name)
Lookup named typedef and reset the iterator to point to it.
int InternalNext()
Increment the iterator, return true if new position is valid.
int Next()
Increment the iterator.
int Size() const
Return the size in bytes of the underlying type of the current typedef.
std::vector< clang::DeclContext::decl_iterator > fIterStack
cling::Interpreter * fInterp
std::string InsertStd(const char *tname)
static constexpr double L