34#include "cling/Interpreter/Interpreter.h"
35#include "cling/Interpreter/LookupHelper.h"
36#include "cling/Utils/AST.h"
38#include "clang/AST/ASTContext.h"
39#include "clang/AST/Decl.h"
40#include "clang/AST/DeclCXX.h"
41#include "clang/AST/DeclTemplate.h"
42#include "clang/AST/GlobalDecl.h"
43#include "clang/AST/PrettyPrinter.h"
44#include "clang/AST/RecordLayout.h"
45#include "clang/AST/Type.h"
46#include "clang/Basic/Specifiers.h"
47#include "clang/Frontend/CompilerInstance.h"
48#include "clang/Sema/Sema.h"
50#include "llvm/ExecutionEngine/GenericValue.h"
51#include "llvm/Support/Casting.h"
52#include "llvm/Support/raw_ostream.h"
63 if (
const NamedDecl* ND = llvm::dyn_cast<NamedDecl>(decl)) {
64 PrintingPolicy Policy(decl->getASTContext().getPrintingPolicy());
65 llvm::raw_string_ostream stream(buf);
66 ND->getNameForDiagnostic(stream, Policy,
true);
72 :
TClingDeclInfo(nullptr), fInterp(interp), fFirstTime(true), fDescend(false), fIterAll(all),
73 fIsIter(true), fType(0), fOffsetCache(0)
75 TranslationUnitDecl *TU =
76 interp->getCI()->getASTContext().getTranslationUnitDecl();
83 :
TClingDeclInfo(nullptr), fInterp(interp), fFirstTime(true), fDescend(false), fIterAll(
kTRUE), fIsIter(false),
84 fType(0), fTitle(
""), fOffsetCache(0)
86 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
88 const Decl *decl = lh.findScope(
name,
89 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
90 : cling::LookupHelper::NoDiagnostics,
91 &
type, intantiateTemplate);
95 decl = lh.findScope(buf,
96 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
97 : cling::LookupHelper::NoDiagnostics,
98 &
type, intantiateTemplate);
102 const TagType *tagtype =
type->getAs<TagType>();
104 decl = tagtype->getDecl();
109 if (decl && decl->isInvalidDecl()) {
110 Error(
"TClingClassInfo",
"Found an invalid decl for %s.",
name);
118 :
TClingDeclInfo(nullptr), fInterp(interp), fFirstTime(true), fDescend(false), fIterAll(
kTRUE),
119 fIsIter(false), fType(0), fTitle(
""), fOffsetCache(0)
126 :
TClingDeclInfo(nullptr), fInterp(interp), fFirstTime(true), fDescend(false), fIterAll(
kTRUE),
127 fIsIter(false), fType(0), fTitle(
""), fOffsetCache(0)
139 fOffsetCache[decl] = std::make_pair(offset, executableFunc);
148 const RecordDecl *RD = llvm::dyn_cast<RecordDecl>(
GetDecl());
151 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
163 const CXXRecordDecl *CRD =
164 llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
168 if (CRD->isAbstract()) {
171 if (CRD->hasUserDeclaredConstructor()) {
175 !CRD->hasUserDeclaredConstructor() &&
176 !CRD->hasTrivialDefaultConstructor()
181 CRD->hasUserProvidedDefaultConstructor() ||
182 !CRD->hasTrivialDefaultConstructor()
186 if (CRD->hasUserDeclaredDestructor()) {
189 else if (!CRD->hasTrivialDestructor()) {
192 if (CRD->hasUserDeclaredCopyAssignment()) {
195 if (CRD->isPolymorphic()) {
206 Error(
"TClingClassInfo::Delete()",
"Called while invalid!");
210 Error(
"TClingClassInfo::Delete()",
"Class is not loaded: %s",
231 Error(
"DeleteArray",
"Placement delete of an array is unsupported!\n");
258 const TypedefType *TT = llvm::dyn_cast<TypedefType>(
fType);
260 llvm::StringRef tname(TT->getDecl()->getName());
261 if (tname.equals(fname)) {
262 const NamedDecl *ndecl = llvm::dyn_cast<NamedDecl>(
GetDecl());
263 if (ndecl && !ndecl->getName().equals(fname)) {
270 const cling::LookupHelper &lh =
fInterp->getLookupHelper();
271 const FunctionTemplateDecl *fd
272 = lh.findFunctionTemplate(
GetDecl(), fname,
273 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
274 : cling::LookupHelper::NoDiagnostics,
false);
275 if (fd)
return fd->getCanonicalDecl();
284 const cling::LookupHelper &lh =
fInterp->getLookupHelper();
287 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
288 : cling::LookupHelper::NoDiagnostics);
289 if (vd)
return llvm::dyn_cast<ValueDecl>(vd->getCanonicalDecl());
305 const TypedefType *TT = llvm::dyn_cast<TypedefType>(
fType);
307 llvm::StringRef tname(TT->getDecl()->getName());
308 if (tname.equals(fname)) {
309 const NamedDecl *ndecl = llvm::dyn_cast<NamedDecl>(
GetDecl());
310 if (ndecl && !ndecl->getName().equals(fname)) {
312 return GetMethod(ndecl->getName().str().c_str());
317 const cling::LookupHelper &lh =
fInterp->getLookupHelper();
318 const FunctionDecl *fd
319 = lh.findAnyFunction(
GetDecl(), fname,
320 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
321 : cling::LookupHelper::NoDiagnostics,
341 const char *
proto,
bool objectIsConst,
356 const TypedefType *TT = llvm::dyn_cast<TypedefType>(
fType);
358 llvm::StringRef tname(TT->getDecl()->getName());
359 if (tname.equals(fname)) {
360 const NamedDecl *ndecl = llvm::dyn_cast<NamedDecl>(
GetDecl());
361 if (ndecl && !ndecl->getName().equals(fname)) {
364 objectIsConst,poffset,
371 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
372 const FunctionDecl *fd;
375 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
376 : cling::LookupHelper::NoDiagnostics,
380 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
381 : cling::LookupHelper::NoDiagnostics,
384 Error(
"TClingClassInfo::GetMethod",
385 "The MatchMode %d is not supported.", mode);
403 const clang::DeclContext* ourDC = llvm::dyn_cast<clang::DeclContext>(
GetDecl());
404 if (!fd->getDeclContext()->Equals(ourDC)
405 && !(fd->getDeclContext()->isTransparentContext()
406 && fd->getDeclContext()->getParent()->Equals(ourDC)))
410 if (poffset) *poffset = 0;
414 if (
const CXXMethodDecl *md =
415 llvm::dyn_cast<CXXMethodDecl>(fd)) {
427 const llvm::SmallVectorImpl<clang::QualType> &
proto,
435 const llvm::SmallVectorImpl<clang::QualType> &
proto,
bool objectIsConst,
450 const TypedefType *TT = llvm::dyn_cast<TypedefType>(
fType);
452 llvm::StringRef tname(TT->getDecl()->getName());
453 if (tname.equals(fname)) {
454 const NamedDecl *ndecl = llvm::dyn_cast<NamedDecl>(
GetDecl());
455 if (ndecl && !ndecl->getName().equals(fname)) {
457 return GetMethod(ndecl->getName().str().c_str(),
proto,objectIsConst,poffset,
464 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
465 const FunctionDecl *fd;
468 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
469 : cling::LookupHelper::NoDiagnostics,
473 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
474 : cling::LookupHelper::NoDiagnostics,
477 Error(
"TClingClassInfo::GetMethod",
478 "The MatchMode %d is not supported.", mode);
489 if (
const CXXMethodDecl *md =
490 llvm::dyn_cast<CXXMethodDecl>(fd)) {
508 const char *arglist,
bool objectIsConst,
516 const TypedefType *TT = llvm::dyn_cast<TypedefType>(
fType);
518 llvm::StringRef tname(TT->getDecl()->getName());
519 if (tname.equals(fname)) {
520 const NamedDecl *ndecl = llvm::dyn_cast<NamedDecl>(
GetDecl());
521 if (ndecl && !ndecl->getName().equals(fname)) {
523 return GetMethod(ndecl->getName().str().c_str(),arglist,
524 objectIsConst,poffset
538 if (!strcmp(arglist,
")")) {
542 const cling::LookupHelper &lh =
fInterp->getLookupHelper();
543 const FunctionDecl *fd
544 = lh.findFunctionArgs(
GetDecl(), fname, arglist,
545 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
546 : cling::LookupHelper::NoDiagnostics,
555 if (
const CXXMethodDecl *md =
556 llvm::dyn_cast<CXXMethodDecl>(fd)) {
581 clang_val =
static_cast<int>(num_params);
592 const CXXRecordDecl* definer = md->getParent();
593 const CXXRecordDecl* accessor =
594 llvm::cast<CXXRecordDecl>(
GetDecl());
595 if (definer != accessor) {
602 if (bci->
GetDecl() == definer) {
622 std::pair<ptrdiff_t, OffsetPtrFunc_t> offsetCache = (*iter).second;
625 return (*executableFunc)(address, isDerivedObject);
628 Error(
"TClingBaseClassInfo::Offset",
"The address of the object for virtual base offset calculation is not valid.");
633 return offsetCache.first;
641 return binfo.
Offset(address, isDerivedObject);
647 std::vector<std::string> res;
651 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
652 const auto DC = dyn_cast<DeclContext>(
fDecl);
656 clang::PrintingPolicy policy(
fDecl->getASTContext().getPrintingPolicy());
657 for (
auto UD : DC->using_directives()) {
658 NamespaceDecl *NS = UD->getNominatedNamespace();
661 llvm::raw_string_ostream stream(nsName);
663 NS->getNameForDiagnostic(stream, policy,
true);
666 res.push_back(nsName);
687 return EIOCtorCategory::kAbsent;
689 auto CRD = llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
692 return EIOCtorCategory::kAbsent;
695 auto kind = CheckIOConstructor(CRD,
"TRootIOCtor",
nullptr, *
fInterp);
696 if ((kind == EIOCtorCategory::kIORefType) || (kind == EIOCtorCategory::kIOPtrType)) {
697 if (type_name) *type_name =
"TRootIOCtor";
701 kind = CheckIOConstructor(CRD,
"__void__",
nullptr, *
fInterp);
702 if (kind == EIOCtorCategory::kIORefType) {
703 if (type_name) *type_name =
"__void__";
708 return CheckDefaultConstructor(CRD, *
fInterp) ? EIOCtorCategory::kDefault : EIOCtorCategory::kAbsent;
715 return fInterp->getLookupHelper()
717 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
718 : cling::LookupHelper::NoDiagnostics);
728 fIter = DeclContext::decl_iterator();
732 const cling::LookupHelper& lh =
fInterp->getLookupHelper();
734 : cling::LookupHelper::NoDiagnostics,
739 SetDecl(lh.findScope(buf,
gDebug > 5 ? cling::LookupHelper::WithDiagnostics
740 : cling::LookupHelper::NoDiagnostics,
745 const TagType *tagtype =
fType->getAs<TagType>();
757 fIter = DeclContext::decl_iterator();
765 Fatal(
"TClingClassInfo::Init(tagnum)",
"Should no longer be called");
775 const TagType *tagtype =
fType->getAs<TagType>();
783 QualType qType(
fType,0);
784 static PrintingPolicy printPol(
fInterp->getCI()->getLangOpts());
785 printPol.SuppressScope =
false;
786 Error(
"TClingClassInfo::Init(const Type&)",
787 "The given type %s does not point to a Decl",
788 qType.getAsString(printPol).c_str());
804 const CXXRecordDecl *CRD =
805 llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
811 const CXXRecordDecl *baseCRD =
812 llvm::dyn_cast<CXXRecordDecl>(base.
GetDecl());
813 return CRD->isDerivedFrom(baseCRD);
829 if (
auto *ED = llvm::dyn_cast<clang::EnumDecl>(
GetDecl()))
830 return ED->isScoped();
841 if (
auto ED = llvm::dyn_cast<EnumDecl>(
GetDecl())) {
843 auto Ty = ED->getIntegerType().getTypePtrOrNull();
844 if (
auto BTy = llvm::dyn_cast_or_null<BuiltinType>(Ty)) {
845 switch (BTy->getKind()) {
846 case BuiltinType::Bool:
849 case BuiltinType::Char_U:
850 case BuiltinType::UChar:
853 case BuiltinType::Char_S:
854 case BuiltinType::SChar:
857 case BuiltinType::UShort:
859 case BuiltinType::Short:
861 case BuiltinType::UInt:
863 case BuiltinType::Int:
865 case BuiltinType::ULong:
867 case BuiltinType::Long:
869 case BuiltinType::ULongLong:
871 case BuiltinType::LongLong:
897 const CXXRecordDecl *CRD = llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
899 if (!CRD->hasDefinition()) {
903 const TagDecl *TD = llvm::dyn_cast<TagDecl>(
GetDecl());
904 if (TD && TD->getDefinition() == 0) {
935 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
938 const clang::DeclContext *DC = cast<DeclContext>(
GetDecl());
940 fIter = DC->decls_begin();
942 fIter = DC->noload_decls_begin();
949 if (
const NamedDecl* ND =
950 llvm::dyn_cast<NamedDecl>(
GetDecl())) {
951 PrintingPolicy Policy(
GetDecl()->getASTContext().
952 getPrintingPolicy());
953 llvm::raw_string_ostream stream(buf);
954 ND->getNameForDiagnostic(stream, Policy,
false);
956 Error(
"TClingClassInfo::InternalNext",
957 "Next called but iteration not prepared for %s!", buf.c_str());
959 Error(
"TClingClassInfo::InternalNext",
960 "Next called but iteration not prepared!");
988 DeclContext *DC = llvm::cast<DeclContext>(*
fIter);
990 fIter = DC->decls_begin();
992 fIter = DC->noload_decls_begin();
1012 Decl::Kind DK =
fIter->getKind();
1013 if ((DK == Decl::Namespace) || (DK == Decl::Enum) ||
1014 (DK == Decl::CXXRecord) ||
1015 (DK == Decl::ClassTemplateSpecialization)) {
1016 const TagDecl *TD = llvm::dyn_cast<TagDecl>(*
fIter);
1017 if (TD && !TD->isCompleteDefinition()) {
1021 if (DK == Decl::Namespace) {
1023 if (!
fIter->isCanonicalDecl()) {
1029 if (DK != Decl::Enum) {
1031 DeclContext *DC = llvm::cast<DeclContext>(*
fIter);
1032 if ((
fIterAll && *DC->decls_begin())
1033 || (!
fIterAll && *DC->noload_decls_begin())) {
1043 if (
GetDecl()->isInvalidDecl()) {
1044 Warning(
"TClingClassInfo::Next()",
"Reached an invalid decl.");
1046 if (
const RecordDecl *RD =
1047 llvm::dyn_cast<RecordDecl>(
GetDecl())) {
1048 fType = RD->getASTContext().getRecordType(RD).getTypePtr();
1066 Error(
"TClingClassInfo::New()",
"Called while invalid!");
1070 Error(
"TClingClassInfo::New()",
"Class is not loaded: %s",
1076 std::string type_name;
1080 auto RD = dyn_cast<CXXRecordDecl>(
GetDecl());
1082 Error(
"TClingClassInfo::New()",
"This is a namespace!: %s",
1096 void* obj =
nullptr;
1101 Error(
"TClingClassInfo::New()",
"Call of default constructor "
1102 "failed to return an object for class: %s",
1115 Error(
"TClingClassInfo::New(n)",
"Called while invalid!");
1119 Error(
"TClingClassInfo::New(n)",
"Class is not loaded: %s",
1125 std::string type_name;
1130 auto RD = dyn_cast<CXXRecordDecl>(
GetDecl());
1132 Error(
"TClingClassInfo::New(n)",
"This is a namespace!: %s",
1146 void* obj =
nullptr;
1149 nullptr, (
unsigned long)
n);
1151 Error(
"TClingClassInfo::New(n)",
"Call of default constructor "
1152 "failed to return an array of class: %s",
1166 Error(
"TClingClassInfo::New(n, arena)",
"Called while invalid!");
1170 Error(
"TClingClassInfo::New(n, arena)",
"Class is not loaded: %s",
1176 std::string type_name;
1181 auto RD = dyn_cast<CXXRecordDecl>(
GetDecl());
1183 Error(
"TClingClassInfo::New(n, arena)",
"This is a namespace!: %s",
1197 void* obj =
nullptr;
1201 arena, (
unsigned long)
n);
1211 Error(
"TClingClassInfo::New(arena)",
"Called while invalid!");
1215 Error(
"TClingClassInfo::New(arena)",
"Class is not loaded: %s",
1221 std::string type_name;
1226 auto RD = dyn_cast<CXXRecordDecl>(
GetDecl());
1228 Error(
"TClingClassInfo::New(arena)",
"This is a namespace!: %s",
1242 void* obj =
nullptr;
1262 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
1264 const clang::DeclContext *ctxt =
GetDecl()->getDeclContext();
1265 clang::NamespaceDecl *std_ns =
fInterp->getSema().getStdNamespace();
1266 while (! ctxt->isTranslationUnit()) {
1267 if (ctxt->Equals(std_ns)) {
1271 ctxt = ctxt->getParent();
1273 Decl::Kind DK =
GetDecl()->getKind();
1274 if ((DK == Decl::Namespace) || (DK == Decl::TranslationUnit)) {
1279 const TagDecl *TD = llvm::dyn_cast<TagDecl>(
GetDecl());
1288 const CXXRecordDecl *CRD =
1289 llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
1293 if (CRD->isClass()) {
1295 }
else if (CRD->isStruct()) {
1297 }
else if (CRD->isUnion()) {
1300 if (CRD->hasDefinition() && CRD->isAbstract()) {
1327 Decl::Kind DK =
GetDecl()->getKind();
1328 if (DK == Decl::Namespace) {
1332 else if (DK == Decl::Enum) {
1336 const RecordDecl *RD = llvm::dyn_cast<RecordDecl>(
GetDecl());
1341 if (!RD->getDefinition()) {
1345 ASTContext &Context =
GetDecl()->getASTContext();
1346 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
1347 const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
1348 int64_t
size = Layout.getSize().getQuantity();
1349 int clang_size =
static_cast<int>(
size);
1383 if (
const NamedDecl* ND =
1384 llvm::dyn_cast<NamedDecl>(
GetDecl())) {
1385 PrintingPolicy Policy(
GetDecl()->getASTContext().
1386 getPrintingPolicy());
1387 llvm::raw_string_ostream stream(
output);
1388 ND->getNameForDiagnostic(stream, Policy,
true);
1406 if (
const TagDecl *TD = llvm::dyn_cast<TagDecl>(
GetDecl())) {
1408 if (AnnotateAttr *A = TD->getAttr<AnnotateAttr>()) {
1409 std::string attr = A->getAnnotation().str();
1425 const CXXRecordDecl *CRD =
1426 llvm::dyn_cast<CXXRecordDecl>(
GetDecl());
1427 if (CRD && !CRD->isFromASTFile()) {
1442 TTHREAD_TLS_DECL( std::string, buf);
1444 if (
const NamedDecl* ND = llvm::dyn_cast<NamedDecl>(
GetDecl())) {
1446 buf = ND->getNameAsString();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
static std::string FullyQualifiedName(const Decl *decl)
ptrdiff_t(* OffsetPtrFunc_t)(void *, bool)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD(mutex)
#define R__WRITE_LOCKGUARD(mutex)
Emulation of the CINT BaseClassInfo class.
ptrdiff_t Offset(void *address=0, bool isDerivedObject=true) const
TClingClassInfo * GetBase() const
Emulation of the CINT CallFunc class.
void * ExecDefaultConstructor(const TClingClassInfo *info, ROOT::TMetaUtils::EIOCtorCategory kind, const std::string &type_name, void *address=nullptr, unsigned long nary=0UL)
void ExecDestructor(const TClingClassInfo *info, void *address=nullptr, unsigned long nary=0UL, bool withFree=true)
Emulation of the CINT ClassInfo class.
clang::DeclContext::decl_iterator fIter
static bool IsEnum(cling::Interpreter *interp, const char *name)
long ClassProperty() const
void Init(const char *name)
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
llvm::DenseMap< const clang::Decl *, std::pair< ptrdiff_t, OffsetPtrFunc_t > > fOffsetCache
EDataType GetUnderlyingType() const
std::mutex fOffsetCacheMutex
const char * TmpltName() const
void AddBaseOffsetValue(const clang::Decl *decl, ptrdiff_t offset)
Longptr_t GetOffset(const clang::CXXMethodDecl *md) const
ptrdiff_t GetBaseOffset(TClingClassInfo *toBase, void *address, bool isDerivedObject)
void SetDecl(const clang::Decl *D)
bool IsScopedEnum() const
ROOT::TMetaUtils::EIOCtorCategory HasDefaultConstructor(bool checkio=false, std::string *type_name=nullptr) const
TClingMethodInfo GetMethodWithArgs(const char *fname, const char *arglist, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch, EInheritanceMode imode=kWithInheritance) const
const clang::FunctionTemplateDecl * GetFunctionTemplate(const char *fname) const
int GetMethodNArg(const char *method, const char *proto, Bool_t objectIsConst, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
bool IsValidMethod(const char *method, const char *proto, Bool_t objectIsConst, Longptr_t *offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
bool HasMethod(const char *name) const
std::string fDeclFileName
void DeleteArray(void *arena, bool dtorOnly, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
void * New(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
TClingMethodInfo GetMethod(const char *fname) const
const clang::ValueDecl * GetDataMember(const char *name) const
void Destruct(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
std::vector< std::string > GetUsingNamespaces()
cling::Interpreter * fInterp
std::vector< clang::DeclContext::decl_iterator > fIterStack
bool IsBase(const char *name) const
const clang::Type * fType
void Delete(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const clang::Decl * fDecl
virtual bool IsValid() const
virtual const clang::Decl * GetDecl() const
Emulation of the CINT MethodInfo class.
const clang::FunctionDecl * GetTargetFunctionDecl() const
Get the FunctionDecl, or if this represents a UsingShadowDecl, the underlying target FunctionDecl.
void Init(const clang::FunctionDecl *)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
R__EXTERN TVirtualRWMutex * gCoreMutex
std::string InsertStd(const char *tname)
static void output(int code)