Changeset e3e16bc for src/SymTab


Ignore:
Timestamp:
Sep 13, 2017, 2:34:55 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
982832e
Parents:
9f5ecf5
Message:

Renamed safe_dynamic_cast to strict_dynamic_cast

Location:
src/SymTab
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    r9f5ecf5 re3e16bc  
    1818#include <cstddef>                 // for NULL
    1919#include <algorithm>               // for count_if
    20 #include <cassert>                 // for safe_dynamic_cast, assert, assertf
     20#include <cassert>                 // for strict_dynamic_cast, assert, assertf
    2121#include <iterator>                // for back_insert_iterator, back_inserter
    2222#include <list>                    // for list, _List_iterator, list<>::iter...
     
    250250                // parameters) are using in the variable exprs
    251251                assert( ftype->get_parameters().size() == 2 );
    252                 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    253                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     252                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     253                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    254254
    255255                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
     
    307307
    308308                // assign to destination
    309                 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), safe_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
     309                Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
    310310                genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
    311311        }
     
    436436                                FunctionType * assignType = dcl->get_functionType();
    437437                                assert( assignType->get_parameters().size() == 2 );
    438                                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
     438                                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
    439439                                dcl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    440440                        }
     
    487487                FunctionType * ftype = funcDecl->get_functionType();
    488488                assert( ftype->get_parameters().size() == 2 );
    489                 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    490                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     489                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     490                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    491491
    492492                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
     
    700700
    701701        Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) {
    702                 tupleType = safe_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
     702                tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
    703703                std::string mangleName = SymTab::Mangler::mangleType( tupleType );
    704704                if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;
     
    768768        CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) {
    769769                seenTuples.beginScope();
    770                 compoundStmt = safe_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
     770                compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
    771771                seenTuples.endScope();
    772772                return compoundStmt;
  • src/SymTab/Indexer.cc

    r9f5ecf5 re3e16bc  
    1616#include "Indexer.h"
    1717
    18 #include <cassert>                 // for assert, safe_dynamic_cast
     18#include <cassert>                 // for assert, strict_dynamic_cast
    1919#include <iostream>                // for operator<<, basic_ostream, ostream
    2020#include <string>                  // for string, operator<<, operator!=
  • src/SymTab/Validate.cc

    r9f5ecf5 re3e16bc  
    486486                std::list< DeclarationWithType * > asserts;
    487487                for ( Declaration * decl : inst->baseTrait->members ) {
    488                         asserts.push_back( safe_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
     488                        asserts.push_back( strict_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
    489489                }
    490490                // substitute trait decl parameters for instance parameters
     
    530530                // need to carry over the 'sized' status of each decl in the instance
    531531                for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
    532                         TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( std::get<1>(p) );
     532                        TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) );
    533533                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    534534                                TypeDecl * formalDecl = std::get<0>(p);
     
    892892                        for ( size_t i = 0; paramIter != params->end(); ++paramIter, ++i ) {
    893893                                if ( i < args.size() ) {
    894                                         TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
     894                                        TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
    895895                                        sub.add( (*paramIter)->get_name(), expr->get_type()->clone() );
    896896                                } else if ( i == args.size() ) {
     
    962962                if ( retVals.size() > 1 ) {
    963963                        // generate a single return parameter which is the tuple of all of the return values
    964                         TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
     964                        TupleType * tupleType = strict_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    965965                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    966966                        ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
Note: See TracChangeset for help on using the changeset viewer.