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"
58 "TClingTypeInfo::Init(name): looking up clang type: %s",
name);
60 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
61 clang::QualType QT = lh.findType(
name,
62 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
63 : cling::LookupHelper::NoDiagnostics);
67 "TClingTypeInfo::Init(name): clang type not found: %s",
name);
71 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
72 : cling::LookupHelper::NoDiagnostics);
76 "TClingTypeInfo::Init(name): "
77 "clang type not found name: %s\n", buf.c_str());
84 "TClingTypeInfo::Init(name): found clang type name: %s\n",
93 "TClingTypeInfo::Init(name): clang type found: %s\n",
name);
106 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());
135 switch (TD->getAccess()) {
136 case clang::AS_public:
139 case clang::AS_protected:
142 case clang::AS_private:
146 if (TD->getDeclContext()->isNamespace())
151 assert(
false &&
"Unexpected value for the access property value in Clang");
162 const clang::CXXRecordDecl *CRD =
163 llvm::dyn_cast<clang::CXXRecordDecl>(TD);
166 if (CRD->isClass()) {
169 else if (CRD->isStruct()) {
172 else if (CRD->isUnion()) {
176 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
177 if (CRD->isThisDeclarationADefinition() && CRD->isAbstract()) {
194 clang::QualType QT =
fQualType.getCanonicalType();
196 if (QT->isArrayType()) {
197 QT = llvm::cast<clang::ArrayType>(QT)->getElementType();
200 else if (QT->isReferenceType()) {
202 QT = llvm::cast<clang::ReferenceType>(QT)->getPointeeType();
205 else if (QT->isPointerType()) {
207 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
210 else if (QT->isMemberPointerType()) {
211 QT = llvm::cast<clang::MemberPointerType>(QT)->getPointeeType();
242 if (
const clang::RecordType *RT =
fQualType->getAs<clang::RecordType>()) {
243 if (!RT->getDecl()->getDefinition()) {
248 clang::ASTContext &Context =
fInterp->getCI()->getASTContext();
250 clang::CharUnits::QuantityType Quantity =
251 Context.getTypeSizeInChars(
fQualType).getQuantity();
252 return static_cast<int>(Quantity);
265 TTHREAD_TLS_DECL( std::string, buf);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
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)
void * QualTypePtr() const
Return the QualType as a void pointer.
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)