Ignore:
Timestamp:
Sep 27, 2017, 5:31:02 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
549c006
Parents:
12914e9 (diff), fa16264 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/FunctionDecl.cc

    r12914e9 rea156ae  
    2626#include "Statement.h"           // for CompoundStmt
    2727#include "Type.h"                // for Type, FunctionType, Type::FuncSpecif...
     28#include "VarExprReplacer.h"
    2829
    2930extern bool translation_unit_nomain;
     
    3940FunctionDecl::FunctionDecl( const FunctionDecl &other )
    4041                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     42
     43        VarExprReplacer::DeclMap declMap;
     44        for ( auto p : group_iterate( other.type->parameters, type->parameters ) ) {
     45                declMap[ std::get<0>(p) ] = std::get<1>(p);
     46        }
     47        for ( auto p : group_iterate( other.type->returnVals, type->returnVals ) ) {
     48                declMap[ std::get<0>(p) ] = std::get<1>(p);
     49        }
     50        if ( ! declMap.empty() ) {
     51                VarExprReplacer replacer( declMap );
     52                accept( replacer );
     53        }
    4154}
    4255
     
    4457        delete type;
    4558        delete statements;
     59}
     60
     61FunctionDecl * FunctionDecl::newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements ) {
     62        return new FunctionDecl( name, Type::StorageClasses(), LinkageSpec::C, type, statements );
    4663}
    4764
Note: See TracChangeset for help on using the changeset viewer.