From 54b57bc351eae44b2de713711dada4fa5c7cc3fe Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 25 Jan 2018 09:40:23 -0600 Subject: [PATCH] Pointers to STLs cannot be checkpointed. #552 Added code to disable printing of STLs if it is arrayed or has pointer dimensions. --- trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp | 8 ++++++++ .../codegen/Interface_Code_Gen/PrintFileContentsBase.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp index 91d637ef..a3600ab7 100644 --- a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp +++ b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp @@ -128,6 +128,10 @@ bool FieldVisitor::VisitBuiltinType(clang::BuiltinType *bt) { bool FieldVisitor::VisitConstantArrayType(clang::ConstantArrayType *cat) { //cat->dump() ; std::cout << std::endl ; fdes->addArrayDim(cat->getSize().getZExtValue()) ; + // If this field is an arrayed STL, skip it! + if ( fdes->isSTL() ) { + fdes->setIO(0) ; + } return true; } @@ -249,6 +253,10 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) { bool FieldVisitor::VisitPointerType(clang::PointerType *p) { fdes->addArrayDim(-1) ; + // If this field is a pointer to an STL, skip it! + if ( fdes->isSTL() ) { + fdes->setIO(0) ; + } return true; } diff --git a/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp b/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp index 258b54e8..4718f3dc 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.cpp @@ -60,6 +60,9 @@ bool PrintFileContentsBase::isPrintable( ClassValues * c , FieldDescription * fd if ( !(fdes->getIO() & ioMask) || !fdes->getTypeName().compare("void") || !fdes->getEnumString().compare("TRICK_VOID")) { return false; } + if ( fdes->isSTL() and fdes->getNumDims() ) { + return false; + } if ( fdes->getAccess() == clang::AS_public || (!fdes->isStatic() && !global_compat15 && !c->isCompat15())) { return true; }