Changeset cd6a6ff for src/SynTree


Ignore:
Timestamp:
Dec 3, 2020, 10:44:40 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1db306a
Parents:
b37515b
Message:

Improved coverage of deterministic_output to be much finer grain.

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rb37515b rcd6a6ff  
    7272
    7373        if ( result ) {
    74                 if (!deterministic_output) {
    75                         os << std::endl << indent << "with resolved type:" << std::endl;
    76                         os << (indent+1);
    77                         result->print( os, indent+1 );
    78                 }
     74                os << std::endl << indent << "with resolved type:" << std::endl;
     75                os << (indent+1);
     76                result->print( os, indent+1 );
    7977        }
    8078
  • src/SynTree/NamedTypeDecl.cc

    rb37515b rcd6a6ff  
    2222#include "LinkageSpec.h"         // for Spec, Cforall, linkageName
    2323#include "Type.h"                // for Type, Type::StorageClasses
     24#include "CompilationState.h"
    2425
    2526NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base )
     
    4142        using namespace std;
    4243
    43         if ( name != "" ) os << name << ": ";
     44        if ( ! name.empty() ) {
     45                if( deterministic_output && isUnboundType(name) ) os << "[unbound]:";
     46                else os << name << ": ";
     47        }
    4448
    4549        if ( linkage != LinkageSpec::Cforall ) {
  • src/SynTree/ReferenceToType.cc

    rb37515b rcd6a6ff  
    2424#include "Type.h"             // for TypeInstType, StructInstType, UnionInstType
    2525#include "TypeSubstitution.h" // for TypeSubstitution
     26#include "CompilationState.h"
    2627
    2728class Attribute;
     
    205206
    206207        Type::print( os, indent );
    207         os << "instance of " << typeString() << " " << get_name() << " (" << ( isFtype ? "" : "not" ) << " function type)";
     208        os << "instance of " << typeString() << " ";
     209        const auto & name_ = get_name();
     210        if( deterministic_output && isUnboundType(name) ) os << "[unbound]";
     211        else os << name;
     212        os << " (" << ( isFtype ? "" : "not" ) << " function type)";
    208213        if ( ! parameters.empty() ) {
    209214                os << endl << indent << "... with parameters" << endl;
  • src/SynTree/Type.cc

    rb37515b rcd6a6ff  
    156156const Type::Qualifiers noQualifiers;
    157157
     158bool isUnboundType(const Type * type) {
     159        if (auto typeInst = dynamic_cast<const TypeInstType *>(type)) {
     160                // xxx - look for a type name produced by renameTyVars.
     161
     162                // TODO: once TypeInstType representation is updated, it should properly check
     163                // if the context id is filled. this is a temporary hack for now
     164                return isUnboundType(typeInst->name);
     165        }
     166        return false;
     167}
     168
     169bool isUnboundType(const std::string & tname) {
     170        // xxx - look for a type name produced by renameTyVars.
     171
     172        // TODO: once TypeInstType representation is updated, it should properly check
     173        // if the context id is filled. this is a temporary hack for now
     174        if (std::count(tname.begin(), tname.end(), '_') >= 3) {
     175                return true;
     176        }
     177        return false;
     178}
     179
    158180// Local Variables: //
    159181// tab-width: 4 //
  • src/SynTree/Type.h

    rb37515b rcd6a6ff  
    733733};
    734734
     735
     736bool isUnboundType(const Type * type);
     737bool isUnboundType(const std::string & tname);
     738
    735739// Local Variables: //
    736740// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.