Changeset 5ebb2fbc for src/CodeGen


Ignore:
Timestamp:
Jan 18, 2017, 12:47:15 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, stuck-waitfor-destruct, with_gc
Children:
e9e4e9ee
Parents:
f3b0a07 (diff), c49bf54 (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:/u/cforall/software/cfa/cfa-cc

Location:
src/CodeGen
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixNames.cc

    rf3b0a07 r5ebb2fbc  
    2222#include "SymTab/Mangler.h"
    2323#include "OperatorTable.h"
    24 
    25 extern std::unique_ptr<FunctionDecl> translation_unit_main_signature;
     24#include "FixMain.h"
    2625
    2726namespace CodeGen {
     
    119118
    120119                if(is_main( SymTab::Mangler::mangle(functionDecl, true, true) )) {
    121                         if(translation_unit_main_signature) {
    122                                 throw SemanticError("Multiple definition of main routine\n", functionDecl);
     120                        int nargs = functionDecl->get_functionType()->get_parameters().size();
     121                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
     122                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    123123                        }
    124 
    125124                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), "0") ) ) );
    126                         translation_unit_main_signature.reset( functionDecl->clone() );
     125                        CodeGen::FixMain::registerMain( functionDecl );
    127126                }
    128127        }
  • src/CodeGen/module.mk

    rf3b0a07 r5ebb2fbc  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    2222        CodeGen/GenType.cc \
    2323        CodeGen/FixNames.cc \
     24        CodeGen/FixMain.cc \
    2425        CodeGen/OperatorTable.cc
Note: See TracChangeset for help on using the changeset viewer.