30#include "cling/Interpreter/Interpreter.h"
31#include "cling/Interpreter/LookupHelper.h"
32#include "cling/Utils/AST.h"
34#include "clang/AST/ASTContext.h"
35#include "clang/AST/DeclCXX.h"
36#include "clang/AST/Type.h"
37#include "clang/AST/PrettyPrinter.h"
38#include "clang/Frontend/CompilerInstance.h"
60 "TClingTypeInfo::Init(name): looking up clang type: %s",
name);
62 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
63 clang::QualType QT = lh.findType(
name,
64 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
65 : cling::LookupHelper::NoDiagnostics);
69 "TClingTypeInfo::Init(name): clang type not found: %s",
name);
73 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
74 : cling::LookupHelper::NoDiagnostics);
78 "TClingTypeInfo::Init(name): "
79 "clang type not found name: %s\n", buf.c_str());
86 "TClingTypeInfo::Init(name): found clang type name: %s\n",
95 "TClingTypeInfo::Init(name): clang type found: %s\n",
name);
108 TTHREAD_TLS_DECL( std::string, buf);
124 if (llvm::isa<clang::TypedefType>(*
fQualType)) {
127 clang::QualType QT =
fQualType.getCanonicalType();
129 const clang::TagType *tagQT = llvm::dyn_cast<clang::TagType>(QT.getTypePtr());
132 const clang::TagDecl *TD = llvm::dyn_cast<clang::TagDecl>(tagQT->getDecl());
137 const clang::CXXRecordDecl *CRD =
138 llvm::dyn_cast<clang::CXXRecordDecl>(TD);
139 if (CRD->isClass()) {
142 else if (CRD->isStruct()) {
145 else if (CRD->isUnion()) {
149 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
150 if (CRD->isThisDeclarationADefinition() && CRD->isAbstract()) {
167 clang::QualType QT =
fQualType.getCanonicalType();
169 if (QT->isArrayType()) {
170 QT = llvm::cast<clang::ArrayType>(QT)->getElementType();
173 else if (QT->isReferenceType()) {
175 QT = llvm::cast<clang::ReferenceType>(QT)->getPointeeType();
178 else if (QT->isPointerType()) {
180 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
183 else if (QT->isMemberPointerType()) {
184 QT = llvm::cast<clang::MemberPointerType>(QT)->getPointeeType();
215 if (
const clang::RecordType *RT =
fQualType->getAs<clang::RecordType>()) {
216 if (!RT->getDecl()->getDefinition()) {
221 clang::ASTContext &Context =
fInterp->getCI()->getASTContext();
223 clang::CharUnits::QuantityType Quantity =
224 Context.getTypeSizeInChars(
fQualType).getQuantity();
225 return static_cast<int>(Quantity);
238 TTHREAD_TLS_DECL( std::string, buf);
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD(mutex)
long Property(long property, clang::QualType &qt) const
clang::QualType fQualType
std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
const char * Name() const override
TClingTypeInfo(cling::Interpreter *interp)
cling::Interpreter * fInterp
bool IsValid() const override
void Init(const char *name)
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
std::string InsertStd(const char *tname)