Changes in / [fc56cdbf:8135d4c]


Ignore:
Files:
6 added
162 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rfc56cdbf r8135d4c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 25 15:29:00 2017
    13 // Update Count     : 486
     12// Last Modified On : Fri Aug 18 15:34:00 2017
     13// Update Count     : 488
    1414//
    1515#include "CodeGenerator.h"
     
    7979        }
    8080
    81         CodeGenerator::LineMarker::LineMarker(
    82                         CodeLocation const & loc, bool toPrint) :
    83                 loc(loc), toPrint(toPrint)
    84         {}
    85 
    86         CodeGenerator::LineMarker CodeGenerator::lineDirective(
    87                         BaseSyntaxNode const * node) {
    88                 return LineMarker(node->location, lineMarks);
    89         }
    90 
    91         std::ostream & operator<<(std::ostream & out,
    92                         CodeGenerator::LineMarker const & marker) {
    93                 if (marker.toPrint && marker.loc.isSet()) {
    94                         return out << "\n# " << marker.loc.linenumber << " \""
    95                                 << marker.loc.filename << "\"\n";
    96                 } else if (marker.toPrint) {
    97                         return out << "\n/* Missing CodeLocation */\n";
    98                 } else {
    99                 return out;
     81        /* Using updateLocation at the beginning of a node and nextLine
     82         * within a node should become the method of formating.
     83         */
     84        void CodeGenerator::updateLocation( CodeLocation const & to ) {
     85                if ( !lineMarks ) {
     86                        return;
     87                } else if ( currentLocation.followedBy( to, 0 ) ) {
     88                        return;
     89                } else if ( currentLocation.followedBy( to, 1 ) ) {
     90                        output << "\n" << indent;
     91                        currentLocation.linenumber += 1;
     92                } else if ( currentLocation.followedBy( to, 2 ) ) {
     93                        output << "\n\n" << indent;
     94                        currentLocation.linenumber += 2;
     95                } else {
     96                        output << "\n# " << to.linenumber << " \"" << to.filename
     97                               << "\"\n" << indent;
     98                        currentLocation = to;
     99                }
     100                output << std::flush;
     101        }
     102
     103        void CodeGenerator::updateLocation( BaseSyntaxNode const * to ) {
     104                updateLocation( to->location );
     105        }
     106
     107        void CodeGenerator::nextLine() {
     108                if ( !lineMarks ) {
     109                        output << "\n" << indent << std::flush;
    100110                }
    101111        }
     
    195205                        ++indent;
    196206                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) {
    197                                 output << lineDirective( *i ) << indent;
     207                                updateLocation( *i );
    198208                                (*i)->accept( *this );
    199209                                output << ";" << endl;
     
    218228        void CodeGenerator::visit( EnumDecl * enumDecl ) {
    219229                extension( enumDecl );
    220                 output << lineDirective ( enumDecl );
     230                updateLocation( enumDecl );
    221231                output << "enum ";
    222232                genAttributes( enumDecl->get_attributes() );
     
    234244                                ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
    235245                                assert( obj );
    236                                 output << lineDirective( obj ) << indent << mangleName( obj );
     246                                updateLocation( obj );
     247                                output << mangleName( obj );
    237248                                if ( obj->get_init() ) {
    238249                                        output << " = ";
     
    252263        void CodeGenerator::visit( TypedefDecl * typeDecl ) {
    253264                assertf( ! genC, "Typedefs are removed and substituted in earlier passes." );
    254                 output << lineDirective( typeDecl );
     265                updateLocation( typeDecl );
    255266                output << "typedef ";
    256267                output << genType( typeDecl->get_base(), typeDecl->get_name(), pretty, genC ) << endl;
     
    741752        void CodeGenerator::visit( StmtExpr * stmtExpr ) {
    742753                std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
    743                 output << lineDirective( stmtExpr) << "({" << std::endl;
     754                updateLocation( stmtExpr );
     755                output << "({" << std::endl;
    744756                ++indent;
    745757                unsigned int numStmts = stmts.size();
    746758                unsigned int i = 0;
    747759                for ( Statement * stmt : stmts ) {
    748                         output << lineDirective( stmt ) << indent;
     760                        updateLocation( stmt );
    749761                        output << printLabels( stmt->get_labels() );
    750762                        if ( i+1 == numStmts ) {
     
    832844
    833845        void CodeGenerator::visit( IfStmt * ifStmt ) {
    834                 output << lineDirective( ifStmt );
     846                updateLocation( ifStmt );
    835847                output << "if ( ";
    836848                ifStmt->get_condition()->accept( *this );
     
    846858
    847859        void CodeGenerator::visit( SwitchStmt * switchStmt ) {
    848                 output << lineDirective( switchStmt );
     860                updateLocation( switchStmt );
    849861                output << "switch ( " ;
    850862                switchStmt->get_condition()->accept( *this );
     
    859871
    860872        void CodeGenerator::visit( CaseStmt * caseStmt ) {
    861                 output << lineDirective( caseStmt );
    862                 output << indent;
     873                updateLocation( caseStmt );
    863874                if ( caseStmt->isDefault()) {
    864875                        output << "default";
  • src/CodeGen/CodeGenerator.h

    rfc56cdbf r8135d4c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 25 25:30:00 2017
    13 // Update Count     : 54
     12// Last Modified On : Fri Aug 18 15:40:00 2017
     13// Update Count     : 56
    1414//
    1515
     
    2121
    2222#include "Common/Indenter.h"      // for Indenter
    23 
    2423#include "SynTree/Declaration.h"  // for DeclarationWithType (ptr only), Fun...
    2524#include "SynTree/Visitor.h"      // for Visitor
    2625#include "SynTree/SynTree.h"      // for Visitor Nodes
    27 
    28 #include "Common/Indenter.h"      // for Indenter
    2926
    3027namespace CodeGen {
     
    113110                };
    114111
    115                 struct LineMarker {
    116                         CodeLocation const & loc;
    117                         bool toPrint;
    118 
    119                         LineMarker(CodeLocation const & loc, bool toPrint);
    120                 };
    121 
    122                 LineMarker lineDirective(BaseSyntaxNode const * node);
    123 
    124112                void asmName( DeclarationWithType *decl );
    125113
    126114                void extension( Expression *expr );
    127115                void extension( Declaration *decl );
     116
     117                void updateLocation( BaseSyntaxNode const * to );
    128118          private:
    129119                Indenter indent;
     
    134124                bool genC = false;    // true if output has to be C code
    135125                bool lineMarks = false;
     126
     127                CodeLocation currentLocation;
     128                void updateLocation( CodeLocation const & to );
     129                void nextLine();
    136130
    137131                void handleStorageClass( DeclarationWithType *decl );
     
    160154        /// returns C-compatible name of declaration
    161155        std::string genName( DeclarationWithType * decl );
    162 
    163         std::ostream & operator<<(std::ostream &,
    164                 CodeGenerator::LineMarker const &);
    165156} // namespace CodeGen
    166157
  • src/CodeGen/Generate.cc

    rfc56cdbf r8135d4c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May 19 13:05:00 2017
    13 // Update Count     : 6
     12// Last Modified On : Fri Aug 18 15:39:00 2017
     13// Update Count     : 7
    1414//
    1515#include "Generate.h"
     
    3333                for ( auto & dcl : translationUnit ) {
    3434                        if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
    35                                 os << cgv.lineDirective(dcl);
     35                                cgv.updateLocation( dcl );
    3636                                dcl->accept(cgv);
    3737                                if ( doSemicolon( dcl ) ) {
  • src/CodeTools/TrackLoc.cc

    rfc56cdbf r8135d4c  
    1818#include <cstdlib>                   // for exit, EXIT_FAILURE
    1919#include <iostream>                  // for operator<<, ostream, basic_ostream
     20#include <iterator>                  // for back_inserter, inserter
    2021#include <stack>                     // for stack
    2122#include <string>                    // for operator<<, string
     
    2324
    2425#include "Common/PassVisitor.h"      // for PassVisitor
     26#include "Common/SemanticError.h"    // for SemanticError
    2527#include "Common/utility.h"          // for CodeLocation
    2628#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     29#include "SynTree/Mutator.h"         // for mutateAll
     30#include "SynTree/Visitor.h"         // for acceptAll
    2731
    2832class Declaration;
  • src/Common/PassVisitor.h

    rfc56cdbf r8135d4c  
    11#pragma once
     2
     3// IWYU pragma: private, include "Common/PassVisitor.h"
    24
    35#include <stack>
  • src/Common/SemanticError.h

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:18:59 2017
    13 // Update Count     : 6
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 14:01:00 2017
     13// Update Count     : 7
    1414//
    1515
     
    2121#include <string>     // for string
    2222
    23 #include "utility.h"  // for CodeLocation, toString
     23#include "CodeLocation.h"  // for CodeLocation, toString
    2424
    2525struct error {
  • src/Common/utility.h

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:19:13 2017
    13 // Update Count     : 33
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 11:38:00 2017
     13// Update Count     : 34
    1414//
    1515
     
    2727
    2828#include <cassert>
     29
    2930template< typename T >
    3031static inline T * maybeClone( const T *orig ) {
     
    347348}
    348349
    349 struct CodeLocation {
    350         int linenumber;
    351         std::string filename;
    352 
    353         /// Create a new unset CodeLocation.
    354         CodeLocation()
    355                 : linenumber( -1 )
    356                 , filename("")
    357         {}
    358 
    359         /// Create a new CodeLocation with the given values.
    360         CodeLocation( const char* filename, int lineno )
    361                 : linenumber( lineno )
    362                 , filename(filename ? filename : "")
    363         {}
    364 
    365         CodeLocation( const CodeLocation& rhs ) = default;
    366 
    367         bool isSet () const {
    368                 return -1 != linenumber;
    369         }
    370 
    371         bool isUnset () const {
    372                 return !isSet();
    373         }
    374 
    375         void unset () {
    376                 linenumber = -1;
    377                 filename = "";
    378         }
    379 
    380         // Use field access for set.
    381 };
    382 
    383 inline std::string to_string( const CodeLocation& location ) {
    384         return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
    385 }
    386 
    387350// Local Variables: //
    388351// tab-width: 4 //
  • src/ControlStruct/ExceptTranslate.cc

    rfc56cdbf r8135d4c  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Aug  8 16:54:00 2017
    13 // Update Count     : 7
     12// Last Modified On : Thr Aug 17 17:19:00 2017
     13// Update Count     : 9
    1414//
    1515
    1616#include "ExceptTranslate.h"
    17 #include "Common/PassVisitor.h"
    18 #include "SynTree/Statement.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Attribute.h"
    23 #include "SynTree/VarExprReplacer.h"
     17
     18#include <stddef.h>                   // for NULL
     19#include <cassert>                    // for assert, assertf
     20#include <iterator>                   // for back_inserter, inserter
     21#include <string>                     // for string, operator==
     22
     23#include "Common/PassVisitor.h"       // for PassVisitor, WithGuards
     24#include "Common/SemanticError.h"     // for SemanticError
     25#include "Common/utility.h"           // for CodeLocation
     26#include "Parser/LinkageSpec.h"       // for Cforall
     27#include "SynTree/Attribute.h"        // for Attribute
     28#include "SynTree/Constant.h"         // for Constant
     29#include "SynTree/Declaration.h"      // for ObjectDecl, FunctionDecl, Struc...
     30#include "SynTree/Expression.h"       // for UntypedExpr, ConstantExpr, Name...
     31#include "SynTree/Initializer.h"      // for SingleInit, ListInit
     32#include "SynTree/Label.h"            // for Label, noLabels
     33#include "SynTree/Mutator.h"          // for mutateAll
     34#include "SynTree/Statement.h"        // for CompoundStmt, CatchStmt, ThrowStmt
     35#include "SynTree/Type.h"             // for FunctionType, Type, noQualifiers
     36#include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
     37#include "SynTree/Visitor.h"          // for acceptAll
    2438
    2539namespace ControlStruct {
     
    152166                        /*bitfieldWidth*/ NULL,
    153167                        new BasicType( noQualifiers, BasicType::Bool ),
    154                         /*init*/ NULL
     168                        /*init*/ NULL,
     169                        std::list<Attribute *>{ new Attribute( "unused" ) }
    155170                        );
    156171                ObjectDecl voidptr_obj(
     
    169184                        );
    170185
     186                ObjectDecl * unused_index_obj = index_obj.clone();
     187                unused_index_obj->attributes.push_back( new Attribute( "unused" ) );
     188
    171189                catch_func_t.get_parameters().push_back( index_obj.clone() );
    172190                catch_func_t.get_parameters().push_back( exception_obj.clone() );
    173                 match_func_t.get_returnVals().push_back( index_obj.clone() );
     191                match_func_t.get_returnVals().push_back( unused_index_obj );
    174192                match_func_t.get_parameters().push_back( exception_obj.clone() );
    175193                handle_func_t.get_returnVals().push_back( bool_obj.clone() );
     
    403421                }
    404422
    405                 body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
    406                         Constant::from_int( 0 ) ) ) );
     423                body->push_back( new ReturnStmt( noLabels,
     424                        new ConstantExpr( Constant::from_int( 0 ) ) ) );
    407425
    408426                return new FunctionDecl("match", Type::StorageClasses(),
     
    435453                CompoundStmt * body = new CompoundStmt( noLabels );
    436454
    437                 FunctionType * func_type = match_func_t.clone();
     455                FunctionType * func_type = handle_func_t.clone();
    438456                DeclarationWithType * except_obj = func_type->get_parameters().back();
    439457
     
    458476                }
    459477
    460                 body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
    461                         Constant::from_bool( false ) ) ) );
     478                body->push_back( new ReturnStmt( noLabels,
     479                        new ConstantExpr( Constant::from_bool( false ) ) ) );
    462480
    463481                return new FunctionDecl("handle", Type::StorageClasses(),
  • src/ControlStruct/ExceptTranslate.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include "SynTree/SynTree.h"
     18#include <list>  // for list
     19
     20class Declaration;
    2021
    2122namespace ControlStruct {
  • src/ControlStruct/ForExprMutator.cc

    rfc56cdbf r8135d4c  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Jul 14 12:14:44 2015
    13 // Update Count     : 10
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Aug 18 10:22:00 2017
     13// Update Count     : 12
    1414//
    1515
    16 #include "SynTree/Mutator.h"
    17 #include "SynTree/Statement.h"
     16#include <list>                 // for list, _List_iterator, list<>::iterator
     17
    1818#include "ForExprMutator.h"
     19#include "SynTree/Label.h"      // for Label
     20#include "SynTree/Statement.h"  // for Statement (ptr only), ForStmt, Compou...
    1921
    2022namespace ControlStruct {
     23        Statement *hoist( Statement *originalStmt, std::list<Statement *> &init ) {
     24                // If no hoisting is needed, skip:
     25                if ( 0 == init.size() ) {
     26                        return originalStmt;
     27                }
     28
     29                // Create compound statement, move initializers outside,
     30                // the resut of the original stays as is.
     31                CompoundStmt *block = new CompoundStmt( std::list< Label >() );
     32                std::list<Statement *> &stmts = block->get_kids();
     33                stmts.splice( stmts.end(), init );
     34
     35                // Add for to the new block.
     36                stmts.push_back( originalStmt );
     37                return block;
     38        }
     39
     40        Statement *ForExprMutator::postmutate( IfStmt *ifStmt ) {
     41                return hoist( ifStmt, ifStmt->initialization );
     42        }
    2143        Statement *ForExprMutator::postmutate( ForStmt *forStmt ) {
    2244                // hoist any initializer declarations to make them C89 (rather than C99)
    23                 std::list<Statement *> &init = forStmt->get_initialization();
    24                 if ( init.size() == 0 ) {
    25                         return forStmt;
    26                 } // if
    27 
    28                 // create compound statement, move initializers outside, leave _for_ as-is
    29                 CompoundStmt *block = new CompoundStmt( std::list< Label >() );
    30                 std::list<Statement *> &stmts = block->get_kids();
    31                 for ( std::list<Statement *>::iterator it = init.begin(); it != init.end(); ++it ) {
    32                         stmts.push_back( *it );
    33                 }       // for
    34 
    35                 // add for to the new block
    36                 stmts.push_back( forStmt );
    37                 forStmt->set_initialization( std::list<Statement *>() );
    38                 return block;
     45                return hoist( forStmt, forStmt->initialization );
    3946        }
    4047} // namespace ControlStruct
  • src/ControlStruct/ForExprMutator.h

    rfc56cdbf r8135d4c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:17:08 2017
    13 // Update Count     : 4
     12// Last Modified On : Thu Aug 17 15:32:48 2017
     13// Update Count     : 5
    1414//
    1515
    1616#pragma once
    1717
    18 #include "SynTree/Mutator.h"
    19 #include "Common/utility.h"
     18class IfStmt;
     19class ForStmt;
     20class Statement;
    2021
    2122namespace ControlStruct {
    2223        class ForExprMutator {
    2324          public:
     25                Statement *postmutate( IfStmt * );
    2426                Statement *postmutate( ForStmt * );
    2527        };
  • src/ControlStruct/LabelFixer.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <list>
    17 #include <cassert>
     16#include <cassert>                         // for assert
     17#include <list>                            // for list, _List_iterator, list...
     18#include <string>                          // for operator+, string, operator==
     19#include <utility>                         // for pair
    1820
     21#include "ControlStruct/LabelGenerator.h"  // for LabelGenerator
    1922#include "LabelFixer.h"
    20 #include "MLEMutator.h"
    21 #include "SynTree/Expression.h"
    22 #include "SynTree/Statement.h"
    23 #include "SynTree/Declaration.h"
    24 #include "Common/utility.h"
    25 
    26 #include <iostream>
     23#include "MLEMutator.h"                    // for MLEMutator
     24#include "SynTree/Declaration.h"           // for FunctionDecl
     25#include "SynTree/Expression.h"            // for NameExpr, Expression, Unty...
     26#include "SynTree/Statement.h"             // for Statement, BranchStmt, Com...
    2727
    2828namespace ControlStruct {
  • src/ControlStruct/LabelFixer.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "Common/utility.h"
    19 #include "SynTree/SynTree.h"
    20 #include "SynTree/Visitor.h"
    21 #include "SynTree/Label.h"
    22 #include "LabelGenerator.h"
    23 #include <map>
     18#include <list>                    // for list
     19#include <map>                     // for map
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "SynTree/Label.h"         // for Label
     23#include "SynTree/Visitor.h"       // for Visitor
     24#include "SynTree/SynTree.h"       // for Visitor Nodes
    2425
    2526namespace ControlStruct {
    2627        /// normalizes label definitions and generates multi-level exit labels
     28class LabelGenerator;
     29
    2730        class LabelFixer final : public Visitor {
    2831                typedef Visitor Parent;
  • src/ControlStruct/LabelGenerator.cc

    rfc56cdbf r8135d4c  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 23 12:18:34 2015
    13 // Update Count     : 13
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 14 14:14:00 2015
     13// Update Count     : 14
    1414//
    1515
    16 #include <iostream>
    17 #include <sstream>
     16#include <iostream>             // for operator<<, basic_ostream
     17#include <sstream>              // for ostringstream
     18#include <list>                 // for list
    1819
    1920#include "LabelGenerator.h"
    20 #include "SynTree/Label.h"
    21 #include "SynTree/Attribute.h"
    22 #include "SynTree/Statement.h"
     21#include "SynTree/Attribute.h"  // for Attribute
     22#include "SynTree/Label.h"      // for Label, operator<<
     23#include "SynTree/Statement.h"  // for Statement
    2324
    2425namespace ControlStruct {
  • src/ControlStruct/LabelGenerator.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
    19 #include <string>
     18#include <string>           // for string
     19
     20#include "SynTree/Label.h"  // for Label
     21
     22class Statement;
    2023
    2124namespace ControlStruct {
  • src/ControlStruct/MLEMutator.cc

    rfc56cdbf r8135d4c  
    2020// where these labels are generated.
    2121
    22 #include <cassert>
    23 #include <algorithm>
    24 
     22#include <ext/alloc_traits.h>              // for __alloc_traits<>::value_type
     23#include <algorithm>                       // for find, find_if
     24#include <cassert>                         // for assert, assertf
     25#include <memory>                          // for allocator_traits<>::value_...
     26
     27#include "Common/utility.h"                // for toString, operator+
     28#include "ControlStruct/LabelGenerator.h"  // for LabelGenerator
    2529#include "MLEMutator.h"
    26 #include "SynTree/Statement.h"
    27 #include "SynTree/Expression.h"
    28 #include "SynTree/Attribute.h"
     30#include "SynTree/Attribute.h"             // for Attribute
     31#include "SynTree/Expression.h"            // for Expression
     32#include "SynTree/Statement.h"             // for BranchStmt, CompoundStmt
    2933
    3034namespace ControlStruct {
  • src/ControlStruct/MLEMutator.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <map>
    19 #include <list>
     18#include <list>                    // for list
     19#include <map>                     // for map
     20#include <string>                  // for string
    2021
    21 #include "Common/utility.h"
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Mutator.h"
    24 #include "SynTree/Label.h"
    25 
    26 #include "LabelGenerator.h"
     22#include "Common/SemanticError.h"  // for SemanticError
     23#include "SynTree/Label.h"         // for Label
     24#include "SynTree/Mutator.h"       // for Mutator
     25#include "SynTree/SynTree.h"       // for Visitor Nodes
    2726
    2827namespace ControlStruct {
     28class LabelGenerator;
     29
    2930        class MLEMutator : public Mutator {
    3031                class Entry;
     32
    3133                typedef Mutator Parent;
    3234          public:
  • src/ControlStruct/Mutate.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
     16#include <iterator>                // for back_inserter, inserter
     17#include <list>                    // for list
    2018
     19#include "Common/PassVisitor.h"    // for mutateAll
     20#include "Common/SemanticError.h"  // for SemanticError
     21#include "ForExprMutator.h"        // for ForExprMutator
     22#include "LabelFixer.h"            // for LabelFixer
    2123#include "Mutate.h"
    22 #include "LabelFixer.h"
    23 #include "MLEMutator.h"
    24 #include "ForExprMutator.h"
     24#include "SynTree/Declaration.h"   // for Declaration
     25#include "SynTree/Mutator.h"       // for mutateAll
    2526//#include "ExceptMutator.h"
    2627
    27 #include "Common/utility.h"
    28 #include "Common/PassVisitor.h"
    29 
    30 #include "SynTree/Visitor.h"
     28#include "Common/PassVisitor.h"    // for PassVisitor
     29#include "SynTree/Visitor.h"       // for acceptAll
    3130
    3231using namespace std;
  • src/ControlStruct/Mutate.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include <iostream>
     18#include <list>  // for list
    2019
    21 #include "SynTree/Declaration.h"
     20class Declaration;
    2221
    2322namespace ControlStruct {
  • src/GenPoly/Box.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iterator>
    18 #include <list>
    19 #include <map>
    20 #include <set>
    21 #include <stack>
    22 #include <string>
    23 #include <utility>
    24 #include <vector>
    25 #include <cassert>
     16#include <algorithm>                     // for mismatch
     17#include <cassert>                       // for assert, safe_dynamic_cast
     18#include <iostream>                      // for operator<<, stringstream
     19#include <list>                          // for list, list<>::iterator, _Lis...
     20#include <map>                           // for _Rb_tree_const_iterator, map
     21#include <memory>                        // for auto_ptr
     22#include <set>                           // for set
     23#include <string>                        // for string, allocator, basic_string
     24#include <utility>                       // for pair
    2625
    2726#include "Box.h"
    28 #include "DeclMutator.h"
    29 #include "Lvalue.h"
    30 #include "FindFunction.h"
    31 #include "PolyMutator.h"
    32 #include "ScopedSet.h"
    33 #include "ScrubTyVars.h"
    34 
    35 #include "Parser/ParseNode.h"
    36 
    37 #include "SynTree/Attribute.h"
    38 #include "SynTree/Constant.h"
    39 #include "SynTree/Declaration.h"
    40 #include "SynTree/Expression.h"
    41 #include "SynTree/Initializer.h"
    42 #include "SynTree/Mutator.h"
    43 #include "SynTree/Statement.h"
    44 #include "SynTree/Type.h"
    45 #include "SynTree/TypeSubstitution.h"
    46 
    47 #include "ResolvExpr/TypeEnvironment.h"
    48 #include "ResolvExpr/TypeMap.h"
    49 #include "ResolvExpr/typeops.h"
    50 
    51 #include "SymTab/Indexer.h"
    52 #include "SymTab/Mangler.h"
    53 
    54 #include "Common/ScopedMap.h"
    55 #include "Common/SemanticError.h"
    56 #include "Common/UniqueName.h"
    57 #include "Common/utility.h"
    5827
    5928#include "CodeGen/OperatorTable.h"
    60 
    61 #include "InitTweak/InitTweak.h"
    62 
    63 #include <ext/functional> // temporary
     29#include "Common/ScopedMap.h"            // for ScopedMap, ScopedMap<>::iter...
     30#include "Common/SemanticError.h"        // for SemanticError
     31#include "Common/UniqueName.h"           // for UniqueName
     32#include "Common/utility.h"              // for toString
     33#include "DeclMutator.h"                 // for DeclMutator
     34#include "FindFunction.h"                // for findFunction, findAndReplace...
     35#include "GenPoly/ErasableScopedMap.h"   // for ErasableScopedMap<>::const_i...
     36#include "GenPoly/GenPoly.h"             // for TyVarMap, isPolyType, mangle...
     37#include "InitTweak/InitTweak.h"         // for getFunctionName, isAssignment
     38#include "Lvalue.h"                      // for generalizedLvalue
     39#include "Parser/LinkageSpec.h"          // for C, Spec, Cforall, Intrinsic
     40#include "PolyMutator.h"                 // for PolyMutator
     41#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass
     42#include "ResolvExpr/typeops.h"          // for typesCompatible
     43#include "ScopedSet.h"                   // for ScopedSet, ScopedSet<>::iter...
     44#include "ScrubTyVars.h"                 // for ScrubTyVars
     45#include "SymTab/Indexer.h"              // for Indexer
     46#include "SymTab/Mangler.h"              // for Mangler
     47#include "SynTree/Attribute.h"           // for Attribute
     48#include "SynTree/Constant.h"            // for Constant
     49#include "SynTree/Declaration.h"         // for DeclarationWithType, ObjectDecl
     50#include "SynTree/Expression.h"          // for ApplicationExpr, UntypedExpr
     51#include "SynTree/Initializer.h"         // for SingleInit, Initializer, Lis...
     52#include "SynTree/Label.h"               // for Label, noLabels
     53#include "SynTree/Mutator.h"             // for maybeMutate, Mutator, mutateAll
     54#include "SynTree/Statement.h"           // for ExprStmt, DeclStmt, ReturnStmt
     55#include "SynTree/SynTree.h"             // for UniqueId
     56#include "SynTree/Type.h"                // for Type, FunctionType, PointerType
     57#include "SynTree/TypeSubstitution.h"    // for TypeSubstitution, operator<<
    6458
    6559namespace GenPoly {
  • src/GenPoly/Box.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include "SynTree/SynTree.h"
     18#include <list>  // for list
     19
     20class Declaration;
    2021
    2122namespace GenPoly {
  • src/GenPoly/CopyParams.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <set>
    17 #include <map>
    18 #include <cassert>
     16#include <cassert>                 // for assert
     17#include <list>                    // for list, _List_iterator, _List_const_...
     18#include <map>                     // for map, _Rb_tree_const_iterator, map<...
     19#include <set>                     // for set, set<>::const_iterator
     20#include <string>                  // for string, operator==
     21#include <utility>                 // for pair
    1922
    20 #include "SynTree/Declaration.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Expression.h"
    23 #include "SynTree/Statement.h"
    24 #include "SynTree/Visitor.h"
    25 #include "Common/UniqueName.h"
     23#include "Common/SemanticError.h"  // for SemanticError
     24#include "Common/UniqueName.h"     // for UniqueName
     25#include "SynTree/Declaration.h"   // for DeclarationWithType, TypeDecl, Fun...
     26#include "SynTree/Expression.h"    // for VariableExpr, ApplicationExpr, Add...
     27#include "SynTree/Label.h"         // for Label, noLabels
     28#include "SynTree/Statement.h"     // for CompoundStmt, DeclStmt, ExprStmt
     29#include "SynTree/SynTree.h"       // for UniqueId
     30#include "SynTree/Type.h"          // for FunctionType, TypeInstType, Type
     31#include "SynTree/Visitor.h"       // for acceptAll, Visitor
    2632
    2733namespace GenPoly {
  • src/GenPoly/DeclMutator.cc

    rfc56cdbf r8135d4c  
    1616#include "DeclMutator.h"
    1717
    18 #include "SynTree/Expression.h"
    19 #include "SynTree/Statement.h"
     18#include <memory>                  // for allocator_traits<>::value_type
     19
     20#include "Common/SemanticError.h"  // for SemanticError
     21#include "SynTree/Declaration.h"   // for Declaration
     22#include "SynTree/Expression.h"    // for Expression
     23#include "SynTree/Label.h"         // for Label, noLabels
     24#include "SynTree/Statement.h"     // for CatchStmt, Statement, CompoundStmt
    2025
    2126namespace GenPoly {
  • src/GenPoly/DeclMutator.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include <vector>
     18#include <list>               // for list
     19#include <vector>             // for vector
    2020
    21 #include "SynTree/SynTree.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Mutator.h"
     21#include "SynTree/Mutator.h"  // for Mutator
     22#include "SynTree/SynTree.h"  // for Visitor Nodes
    2423
    2524namespace GenPoly {
  • src/GenPoly/FindFunction.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "FindFunction.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Visitor.h"
    2017
    21 #include "ScrubTyVars.h"
     18#include <utility>                      // for pair
     19
     20#include "Common/SemanticError.h"       // for SemanticError
     21#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::iterator
     22#include "GenPoly/GenPoly.h"            // for TyVarMap
     23#include "ScrubTyVars.h"                // for ScrubTyVars
     24#include "SynTree/Declaration.h"        // for DeclarationWithType, TypeDecl
     25#include "SynTree/Mutator.h"            // for Mutator, mutateAll
     26#include "SynTree/Type.h"               // for FunctionType, Type, Type::For...
    2227
    2328namespace GenPoly {
  • src/GenPoly/FindFunction.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
    19 #include "GenPoly.h"
     18#include <list>       // for list
     19
     20#include "GenPoly.h"  // for TyVarMap
     21
     22class FunctionType;
     23class Type;
    2024
    2125namespace GenPoly {
  • src/GenPoly/GenPoly.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "GenPoly.h"
    17 #include "assert.h"
    18 
    19 #include "SynTree/Expression.h"
    20 #include "SynTree/Type.h"
    21 #include "ResolvExpr/typeops.h"
    22 
    23 #include <iostream>
    24 #include <iterator>
    25 #include <list>
    26 #include <typeindex>
    27 #include <typeinfo>
    28 #include <vector>
     17
     18#include <cassert>                      // for assertf, assert
     19#include <iostream>                     // for operator<<, ostream, basic_os...
     20#include <iterator>                     // for back_insert_iterator, back_in...
     21#include <list>                         // for list, _List_iterator, list<>:...
     22#include <typeindex>                    // for type_index
     23#include <utility>                      // for pair
     24#include <vector>                       // for vector
     25
     26#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::const_it...
     27#include "ResolvExpr/typeops.h"         // for flatten
     28#include "SynTree/Constant.h"           // for Constant
     29#include "SynTree/Expression.h"         // for Expression, TypeExpr, Constan...
     30#include "SynTree/Type.h"               // for Type, StructInstType, UnionIn...
     31#include "SynTree/TypeSubstitution.h"   // for TypeSubstitution
     32
    2933using namespace std;
    3034
  • src/GenPoly/GenPoly.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <iostream>
    20 #include <utility>
     18#include <iostream>               // for ostream
     19#include <string>                 // for string, allocator, operator+, basic...
    2120
    22 #include "ErasableScopedMap.h"
    23 
    24 #include "SymTab/Mangler.h"
    25 
    26 #include "SynTree/Declaration.h"
    27 #include "SynTree/Type.h"
    28 #include "SynTree/TypeSubstitution.h"
     21#include "ErasableScopedMap.h"    // for ErasableScopedMap
     22#include "SymTab/Mangler.h"       // for Mangler
     23#include "SynTree/Declaration.h"  // for TypeDecl::Data, AggregateDecl, Type...
     24#include "SynTree/SynTree.h"      // for Visitor Nodes
    2925
    3026namespace GenPoly {
     
    6662        Type *hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels = 0, const TypeSubstitution *env = 0 );
    6763
    68         /// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one 
     64        /// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one
    6965        /// polymorphic parameter; will look up substitution in env if provided.
    7066        bool includesPolyType( Type *type, const TypeSubstitution *env = 0 );
    7167
    72         /// true iff this type or some base of this type after dereferencing pointers is either polymorphic in tyVars, or a generic type with 
     68        /// true iff this type or some base of this type after dereferencing pointers is either polymorphic in tyVars, or a generic type with
    7369        /// at least one polymorphic parameter in tyVars; will look up substitution in env if provided.
    7470        bool includesPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
  • src/GenPoly/InstantiateGeneric.cc

    rfc56cdbf r8135d4c  
    1313// Update Count     : 1
    1414//
    15 
    16 #include <cassert>
    17 #include <list>
    18 #include <unordered_map>
    19 #include <utility>
    20 #include <vector>
    21 
    2215#include "InstantiateGeneric.h"
    2316
    24 #include "GenPoly.h"
    25 #include "ScopedSet.h"
    26 #include "ScrubTyVars.h"
    27 
    28 #include "Common/PassVisitor.h"
    29 #include "Common/ScopedMap.h"
    30 #include "Common/UniqueName.h"
    31 #include "Common/utility.h"
    32 
    33 #include "ResolvExpr/typeops.h"
    34 
    35 #include "SynTree/Declaration.h"
    36 #include "SynTree/Expression.h"
    37 #include "SynTree/Type.h"
    38 
    39 
    40 #include "InitTweak/InitTweak.h"
     17#include <cassert>                     // for assertf, assert
     18#include <iterator>                    // for back_inserter, inserter
     19#include <list>                        // for list, _List_const_iterator
     20#include <utility>                     // for move, pair
     21#include <vector>                      // for vector
     22
     23#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
     24#include "Common/ScopedMap.h"          // for ScopedMap
     25#include "Common/SemanticError.h"      // for SemanticError
     26#include "Common/UniqueName.h"         // for UniqueName
     27#include "Common/utility.h"            // for deleteAll, cloneAll
     28#include "GenPoly.h"                   // for isPolyType, typesPolyCompatible
     29#include "ScopedSet.h"                 // for ScopedSet, ScopedSet<>::iterator
     30#include "ScrubTyVars.h"               // for ScrubTyVars
     31#include "SynTree/Declaration.h"       // for StructDecl, UnionDecl, TypeDecl
     32#include "SynTree/Expression.h"        // for TypeExpr, Expression
     33#include "SynTree/Mutator.h"           // for mutateAll
     34#include "SynTree/Type.h"              // for StructInstType, UnionInstType
     35#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     36#include "SynTree/Visitor.h"           // for acceptAll
    4137
    4238
  • src/GenPoly/InstantiateGeneric.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
     18#include <list>  // for list
     19
     20class Declaration;
    1921
    2022namespace GenPoly {
  • src/GenPoly/Lvalue.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
    17 
     16#include <cassert>                       // for safe_dynamic_cast
     17#include <string>                        // for string
     18
     19#include "Common/PassVisitor.h"
     20#include "Common/SemanticError.h"        // for SemanticError
     21#include "GenPoly.h"                     // for isPolyType
    1822#include "Lvalue.h"
    1923
    20 #include "GenPoly.h"
    21 
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Type.h"
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Statement.h"
    26 #include "SynTree/Visitor.h"
    27 #include "SynTree/Mutator.h"
    28 #include "SymTab/Indexer.h"
     24#include "Parser/LinkageSpec.h"          // for Spec, isBuiltin, Intrinsic
     25#include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
     26#include "ResolvExpr/Unify.h"            // for unify
     27#include "ResolvExpr/typeops.h"
    2928#include "SymTab/Autogen.h"
    30 
    31 #include "ResolvExpr/Resolver.h"
    32 #include "ResolvExpr/TypeEnvironment.h"
    33 #include "ResolvExpr/typeops.h"
    34 #include "ResolvExpr/Unify.h"
    35 
    36 #include "Common/UniqueName.h"
    37 #include "Common/utility.h"
    38 #include "Common/PassVisitor.h"
    39 
    40 #include "InitTweak/InitTweak.h"
     29#include "SymTab/Indexer.h"              // for Indexer
     30#include "SynTree/Declaration.h"         // for Declaration, FunctionDecl
     31#include "SynTree/Expression.h"          // for Expression, ConditionalExpr
     32#include "SynTree/Mutator.h"             // for mutateAll, Mutator
     33#include "SynTree/Statement.h"           // for ReturnStmt, Statement (ptr o...
     34#include "SynTree/Type.h"                // for PointerType, Type, FunctionType
     35#include "SynTree/Visitor.h"             // for Visitor, acceptAll
    4136
    4237#if 0
     
    223218                // at inner &, record depth D of reference type
    224219                // at outer &, add D derefs.
    225                 void AddrRef::premutate( Expression * expr ) {
     220                void AddrRef::premutate( Expression * ) {
    226221                        GuardValue( current );
    227222                        GuardValue( first );
     
    230225                }
    231226
    232                 void AddrRef::premutate( AddressExpr * addrExpr ) {
     227                void AddrRef::premutate( AddressExpr * ) {
    233228                        GuardValue( current );
    234229                        GuardValue( first );
  • src/GenPoly/Lvalue.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
     18#include <list>  // for list
    1919
    20 #include "SynTree/SynTree.h"
     20class Declaration;
     21class Expression;
    2122
    2223namespace GenPoly {
  • src/GenPoly/PolyMutator.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "PolyMutator.h"
    17 #include "SynTree/Declaration.h"
    18 #include "SynTree/Type.h"
    19 #include "SynTree/Expression.h"
    20 #include "SynTree/Statement.h"
    21 #include "SynTree/Mutator.h"
    22 #include "SynTree/Initializer.h"
     17
     18#include "Common/SemanticError.h"  // for SemanticError
     19#include "Common/utility.h"        // for ValueGuard
     20#include "SynTree/Declaration.h"   // for Declaration, TypeDecl, TypeDecl::Data
     21#include "SynTree/Expression.h"    // for Expression, UntypedExpr, StmtExpr ...
     22#include "SynTree/Initializer.h"   // for SingleInit, Initializer (ptr only)
     23#include "SynTree/Label.h"         // for Label, noLabels
     24#include "SynTree/Mutator.h"       // for maybeMutate, mutateAll
     25#include "SynTree/Statement.h"     // for CatchStmt, CompoundStmt, ForStmt
     26
     27class TypeSubstitution;
    2328
    2429namespace GenPoly {
  • src/GenPoly/PolyMutator.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <map>
    19 #include <string>
    20 #include <list>
     18#include <list>               // for list
    2119
    22 #include "GenPoly.h"
    23 
    24 #include "SynTree/SynTree.h"
    25 #include "SynTree/Declaration.h"
    26 #include "SynTree/Mutator.h"
     20#include "GenPoly.h"          // for TyVarMap
     21#include "SynTree/Mutator.h"  // for Mutator
     22#include "SynTree/SynTree.h"  // for Visitor Nodes
    2723
    2824namespace GenPoly {
  • src/GenPoly/ScrubTyVars.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <sstream>
    17 #include <string>
     16#include <utility>                      // for pair
    1817
    19 #include "GenPoly.h"
     18#include "GenPoly.h"                    // for mangleType, TyVarMap, alignof...
     19#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::const_it...
    2020#include "ScrubTyVars.h"
    21 
    22 #include "SynTree/Mutator.h"
    23 #include "SynTree/Type.h"
    24 #include "SynTree/Expression.h"
     21#include "SynTree/Declaration.h"        // for TypeDecl, TypeDecl::Data, Typ...
     22#include "SynTree/Expression.h"         // for Expression (ptr only), NameExpr
     23#include "SynTree/Mutator.h"            // for Mutator
     24#include "SynTree/Type.h"               // for PointerType, TypeInstType, Type
    2525
    2626namespace GenPoly {
  • src/GenPoly/ScrubTyVars.h

    rfc56cdbf r8135d4c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScrubTyVars.h -- 
     7// ScrubTyVars.h --
    88//
    99// Author           : Richard C. Bilson
     
    1616#pragma once
    1717
    18 #include <string>
     18#include <cassert>            // for assert
    1919
    20 #include "GenPoly.h"
     20#include "GenPoly.h"          // for TyVarMap, isPolyType, isDynType
     21#include "SynTree/Mutator.h"  // for Mutator
     22#include "SynTree/Type.h"     // for Type (ptr only), PointerType (ptr only)
    2123
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Mutator.h"
     24class AlignofExpr;
     25class Expression;
     26class SizeofExpr;
    2427
    2528namespace GenPoly {
     
    6669                        // return dynamicOnly ? isDynType( ty, tyVars ) : isPolyType( ty, tyVars );
    6770                }
    68                
     71
    6972                /// Mutates (possibly generic) aggregate types appropriately
    7073                Type* mutateAggregateType( Type *ty );
    71                
     74
    7275                const TyVarMap *tyVars;  ///< Type variables to scrub
    7376                ScrubMode mode;          ///< which type variables to scrub? [FromMap]
  • src/GenPoly/Specialize.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
    17 
     16#include <cassert>                       // for assert, assertf
     17#include <iterator>                      // for back_insert_iterator, back_i...
     18#include <map>                           // for _Rb_tree_iterator, _Rb_tree_...
     19#include <memory>                        // for unique_ptr
     20#include <string>                        // for string
     21#include <tuple>                         // for get
     22#include <utility>                       // for pair
     23
     24#include "Common/SemanticError.h"        // for SemanticError
     25#include "Common/UniqueName.h"           // for UniqueName
     26#include "Common/utility.h"              // for group_iterate
     27#include "GenPoly.h"                     // for getFunctionType
     28#include "InitTweak/InitTweak.h"         // for isIntrinsicCallExpr
     29#include "Parser/LinkageSpec.h"          // for C
     30#include "PolyMutator.h"                 // for PolyMutator
     31#include "ResolvExpr/FindOpenVars.h"     // for findOpenVars
     32#include "ResolvExpr/TypeEnvironment.h"  // for OpenVarSet, AssertionSet
    1833#include "Specialize.h"
    19 #include "GenPoly.h"
    20 #include "PolyMutator.h"
    21 
    22 #include "Parser/ParseNode.h"
    23 
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Statement.h"
    26 #include "SynTree/Type.h"
    27 #include "SynTree/Attribute.h"
    28 #include "SynTree/TypeSubstitution.h"
    29 #include "SynTree/Mutator.h"
    30 #include "ResolvExpr/FindOpenVars.h"
    31 #include "Common/UniqueName.h"
    32 #include "Common/utility.h"
    33 #include "InitTweak/InitTweak.h"
    34 #include "Tuples/Tuples.h"
     34#include "SynTree/Attribute.h"           // for Attribute
     35#include "SynTree/Declaration.h"         // for FunctionDecl, DeclarationWit...
     36#include "SynTree/Expression.h"          // for ApplicationExpr, Expression
     37#include "SynTree/Label.h"               // for Label, noLabels
     38#include "SynTree/Mutator.h"             // for mutateAll
     39#include "SynTree/Statement.h"           // for CompoundStmt, DeclStmt, Expr...
     40#include "SynTree/Type.h"                // for FunctionType, TupleType, Type
     41#include "SynTree/TypeSubstitution.h"    // for TypeSubstitution
     42#include "SynTree/Visitor.h"             // for Visitor
    3543
    3644namespace GenPoly {
     
    93101        }
    94102
     103        // walk into tuple type and find the number of components
     104        size_t singleParameterSize( Type * type ) {
     105                if ( TupleType * tt = dynamic_cast< TupleType * >( type ) ) {
     106                        size_t sz = 0;
     107                        for ( Type * t : *tt ) {
     108                                sz += singleParameterSize( t );
     109                        }
     110                        return sz;
     111                } else {
     112                        return 1;
     113                }
     114        }
     115
     116        // find the total number of components in a parameter list
     117        size_t functionParameterSize( FunctionType * ftype ) {
     118                size_t sz = 0;
     119                for ( DeclarationWithType * p : ftype->get_parameters() ) {
     120                        sz += singleParameterSize( p->get_type() );
     121                }
     122                return sz;
     123        }
     124
    95125        bool needsTupleSpecialization( Type *formalType, Type *actualType ) {
    96126                // Needs tuple specialization if the structure of the formal type and actual type do not match.
     
    103133                        FunctionType * aftype = getFunctionType( actualType->stripReferences() );
    104134                        assertf( aftype, "formal type is a function type, but actual type is not: %s", toString( actualType ).c_str() );
     135                        // Can't tuple specialize if parameter sizes deeply-differ.
     136                        if ( functionParameterSize( fftype ) != functionParameterSize( aftype ) ) return false;
     137                        // tuple-parameter sizes are the same, but actual parameter sizes differ - must tuple specialize
    105138                        if ( fftype->get_parameters().size() != aftype->get_parameters().size() ) return true;
     139                        // total parameter size can be the same, while individual parameters can have different structure
    106140                        for ( auto params : group_iterate( fftype->get_parameters(), aftype->get_parameters() ) ) {
    107141                                DeclarationWithType * formal = std::get<0>(params);
  • src/GenPoly/Specialize.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
     18#include <list>  // for list
    1919
    20 #include "SynTree/SynTree.h"
     20class Declaration;
    2121
    2222namespace GenPoly {
  • src/InitTweak/FixGlobalInit.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "FixGlobalInit.h"
    17 #include "InitTweak.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Type.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Statement.h"
    22 #include "SynTree/Initializer.h"
    23 #include "SynTree/Visitor.h"
    24 #include "SynTree/Attribute.h"
    25 #include <algorithm>
     17
     18#include <cassert>                 // for assert
     19#include <stddef.h>                // for NULL
     20#include <algorithm>               // for replace_if
     21
     22#include "Common/SemanticError.h"  // for SemanticError
     23#include "Common/UniqueName.h"     // for UniqueName
     24#include "InitTweak.h"             // for isIntrinsicSingleArgCallStmt
     25#include "Parser/LinkageSpec.h"    // for C
     26#include "SynTree/Attribute.h"     // for Attribute
     27#include "SynTree/Constant.h"      // for Constant
     28#include "SynTree/Declaration.h"   // for FunctionDecl, ObjectDecl, Declaration
     29#include "SynTree/Expression.h"    // for ConstantExpr, Expression (ptr only)
     30#include "SynTree/Initializer.h"   // for ConstructorInit, Initializer
     31#include "SynTree/Label.h"         // for Label, noLabels
     32#include "SynTree/Statement.h"     // for CompoundStmt, Statement (ptr only)
     33#include "SynTree/Type.h"          // for Type, Type::StorageClasses, Functi...
     34#include "SynTree/Visitor.h"       // for acceptAll, Visitor
    2635
    2736namespace InitTweak {
  • src/InitTweak/FixGlobalInit.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <list>
     18#include <list>    // for list
     19#include <string>  // for string
    2020
    21 #include "SynTree/SynTree.h"
    22 #include "SynTree/Declaration.h"
     21class Declaration;
    2322
    2423namespace InitTweak {
  • src/InitTweak/FixInit.cc

    rfc56cdbf r8135d4c  
    1313// Update Count     : 74
    1414//
    15 
    16 #include <stack>
    17 #include <list>
    18 #include <iterator>
    19 #include <algorithm>
    20 #include <unordered_map>
    21 #include <unordered_set>
    22 
    23 #include "InitTweak.h"
    24 #include "GenInit.h"
    2515#include "FixInit.h"
    26 #include "FixGlobalInit.h"
    27 #include "CodeGen/GenType.h"  // for warning/error messages
     16
     17#include <stddef.h>                    // for NULL
     18#include <algorithm>                   // for set_difference, copy_if
     19#include <cassert>                     // for assert, safe_dynamic_cast
     20#include <iostream>                    // for operator<<, ostream, basic_ost...
     21#include <iterator>                    // for insert_iterator, back_inserter
     22#include <list>                        // for _List_iterator, list, list<>::...
     23#include <map>                         // for _Rb_tree_iterator, _Rb_tree_co...
     24#include <memory>                      // for allocator_traits<>::value_type
     25#include <set>                         // for set, set<>::value_type
     26#include <unordered_map>               // for unordered_map, unordered_map<>...
     27#include <unordered_set>               // for unordered_set
     28#include <utility>                     // for pair
     29
     30#include "CodeGen/GenType.h"           // for genPrettyType
    2831#include "CodeGen/OperatorTable.h"
    29 #include "Common/PassVisitor.h"
    30 #include "GenPoly/DeclMutator.h"
    31 #include "GenPoly/PolyMutator.h"
    32 #include "ResolvExpr/Resolver.h"
    33 #include "ResolvExpr/typeops.h"
    34 #include "SymTab/Autogen.h"
    35 #include "SymTab/Indexer.h"
    36 #include "SynTree/AddStmtVisitor.h"
    37 #include "SynTree/Attribute.h"
    38 #include "SynTree/Declaration.h"
    39 #include "SynTree/Expression.h"
    40 #include "SynTree/Initializer.h"
    41 #include "SynTree/Mutator.h"
    42 #include "SynTree/Statement.h"
    43 #include "SynTree/Type.h"
    44 #include "Tuples/Tuples.h"
     32#include "Common/PassVisitor.h"        // for PassVisitor, WithStmtsToAdd
     33#include "Common/SemanticError.h"      // for SemanticError
     34#include "Common/UniqueName.h"         // for UniqueName
     35#include "Common/utility.h"            // for CodeLocation, ValueGuard, toSt...
     36#include "FixGlobalInit.h"             // for fixGlobalInit
     37#include "GenInit.h"                   // for genCtorDtor
     38#include "GenPoly/DeclMutator.h"       // for DeclMutator
     39#include "GenPoly/GenPoly.h"           // for getFunctionType
     40#include "GenPoly/PolyMutator.h"       // for PolyMutator
     41#include "InitTweak.h"                 // for getFunctionName, getCallArg
     42#include "Parser/LinkageSpec.h"        // for C, Spec, Cforall, isBuiltin
     43#include "ResolvExpr/Resolver.h"       // for findVoidExpression
     44#include "ResolvExpr/typeops.h"        // for typesCompatible
     45#include "SymTab/Autogen.h"            // for genImplicitCall
     46#include "SymTab/Indexer.h"            // for Indexer
     47#include "SymTab/Mangler.h"            // for Mangler
     48#include "SynTree/AddStmtVisitor.h"    // for AddStmtVisitor
     49#include "SynTree/Attribute.h"         // for Attribute
     50#include "SynTree/Constant.h"          // for Constant
     51#include "SynTree/Declaration.h"       // for ObjectDecl, FunctionDecl, Decl...
     52#include "SynTree/Expression.h"        // for UniqueExpr, VariableExpr, Unty...
     53#include "SynTree/Initializer.h"       // for ConstructorInit, SingleInit
     54#include "SynTree/Label.h"             // for Label, noLabels, operator<
     55#include "SynTree/Mutator.h"           // for mutateAll, Mutator, maybeMutate
     56#include "SynTree/Statement.h"         // for ExprStmt, CompoundStmt, Branch...
     57#include "SynTree/Type.h"              // for Type, Type::StorageClasses
     58#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution, operator<<
     59#include "SynTree/Visitor.h"           // for acceptAll, maybeAccept
     60#include "Tuples/Tuples.h"             // for isTtype
    4561
    4662bool ctordtorp = false; // print all debug
  • src/InitTweak/FixInit.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <list>
     18#include <list>    // for list
     19#include <string>  // for string
    2020
    21 #include "SynTree/SynTree.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Mutator.h"
     21class Declaration;
    2422
    2523namespace InitTweak {
  • src/InitTweak/GenInit.cc

    rfc56cdbf r8135d4c  
    1313// Update Count     : 183
    1414//
    15 
    16 #include <stack>
    17 #include <list>
    18 
    19 #include "InitTweak.h"
    2015#include "GenInit.h"
    2116
    22 #include "Common/PassVisitor.h"
     17#include <stddef.h>                // for NULL
     18#include <algorithm>               // for any_of
     19#include <cassert>                 // for assert, safe_dynamic_cast, assertf
     20#include <iterator>                // for back_inserter, inserter, back_inse...
     21#include <list>                    // for _List_iterator, list
     22
    2323#include "CodeGen/OperatorTable.h"
    24 
    25 #include "GenPoly/DeclMutator.h"
    26 #include "GenPoly/PolyMutator.h"
    27 #include "GenPoly/ScopedSet.h"
    28 
    29 #include "ResolvExpr/typeops.h"
    30 
    31 #include "SynTree/Declaration.h"
    32 #include "SynTree/Expression.h"
    33 #include "SynTree/Initializer.h"
    34 #include "SynTree/Mutator.h"
    35 #include "SynTree/Statement.h"
    36 #include "SynTree/Type.h"
    37 
    38 #include "SymTab/Autogen.h"
    39 #include "SymTab/Mangler.h"
     24#include "Common/PassVisitor.h"    // for PassVisitor, WithGuards, WithShort...
     25#include "Common/SemanticError.h"  // for SemanticError
     26#include "Common/UniqueName.h"     // for UniqueName
     27#include "Common/utility.h"        // for ValueGuard, maybeClone
     28#include "GenPoly/DeclMutator.h"   // for DeclMutator
     29#include "GenPoly/GenPoly.h"       // for getFunctionType, isPolyType
     30#include "GenPoly/ScopedSet.h"     // for ScopedSet, ScopedSet<>::const_iter...
     31#include "InitTweak.h"             // for isConstExpr, InitExpander, checkIn...
     32#include "Parser/LinkageSpec.h"    // for isOverridable, C
     33#include "SymTab/Autogen.h"        // for genImplicitCall, SizeType
     34#include "SymTab/Mangler.h"        // for Mangler
     35#include "SynTree/Declaration.h"   // for ObjectDecl, DeclarationWithType
     36#include "SynTree/Expression.h"    // for VariableExpr, UntypedExpr, Address...
     37#include "SynTree/Initializer.h"   // for ConstructorInit, SingleInit, Initi...
     38#include "SynTree/Label.h"         // for Label
     39#include "SynTree/Mutator.h"       // for mutateAll
     40#include "SynTree/Statement.h"     // for CompoundStmt, ImplicitCtorDtorStmt
     41#include "SynTree/Type.h"          // for Type, ArrayType, Type::Qualifiers
     42#include "SynTree/Visitor.h"       // for acceptAll, maybeAccept
    4043
    4144namespace InitTweak {
  • src/InitTweak/GenInit.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <list>
     18#include <list>               // for list
     19#include <string>             // for string
    2020
    21 #include "SynTree/SynTree.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Mutator.h"
     21#include "SynTree/SynTree.h"  // for Visitor Nodes
    2422
    2523namespace InitTweak {
  • src/InitTweak/InitTweak.cc

    rfc56cdbf r8135d4c  
    1 #include <algorithm>
     1#include <stddef.h>                // for NULL
     2#include <algorithm>               // for find, all_of
     3#include <cassert>                 // for assertf, assert, safe_dynamic_cast
     4#include <iostream>                // for ostream, cerr, endl
     5#include <iterator>                // for back_insert_iterator, back_inserter
     6#include <memory>                  // for __shared_ptr
     7
     8#include "Common/SemanticError.h"  // for SemanticError
     9#include "Common/UniqueName.h"     // for UniqueName
     10#include "Common/utility.h"        // for toString, deleteAll, maybeClone
     11#include "GenPoly/GenPoly.h"       // for getFunctionType
    212#include "InitTweak.h"
    3 #include "SynTree/Visitor.h"
    4 #include "SynTree/Statement.h"
    5 #include "SynTree/Initializer.h"
    6 #include "SynTree/Expression.h"
    7 #include "SynTree/Attribute.h"
    8 #include "GenPoly/GenPoly.h"
    9 #include "ResolvExpr/typeops.h"
     13#include "Parser/LinkageSpec.h"    // for Spec, isBuiltin, Intrinsic
     14#include "ResolvExpr/typeops.h"    // for typesCompatibleIgnoreQualifiers
     15#include "SymTab/Indexer.h"        // for Indexer
     16#include "SynTree/Attribute.h"     // for Attribute
     17#include "SynTree/Constant.h"      // for Constant
     18#include "SynTree/Declaration.h"   // for ObjectDecl, DeclarationWithType
     19#include "SynTree/Expression.h"    // for Expression, UntypedExpr, Applicati...
     20#include "SynTree/Initializer.h"   // for Initializer, ListInit, Designation
     21#include "SynTree/Label.h"         // for Label, noLabels
     22#include "SynTree/Statement.h"     // for CompoundStmt, ExprStmt, BranchStmt
     23#include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
     24#include "SynTree/Visitor.h"       // for Visitor, maybeAccept
     25
     26class UntypedValofExpr;
    1027
    1128namespace InitTweak {
  • src/InitTweak/InitTweak.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <list>
     18#include <list>               // for list
     19#include <memory>             // for shared_ptr
     20#include <string>             // for string, allocator
    2021
    21 #include "SynTree/SynTree.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Mutator.h"
     22#include "SynTree/SynTree.h"  // for Visitor Nodes
    2423
    2524// helper functions for initialization
     
    9998
    10099                class ExpanderImpl;
     100
    101101                typedef std::list< Expression * > IndexList;
    102102        private:
  • src/Parser/DeclarationNode.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <string>
    17 #include <list>
    18 #include <iterator>
    19 #include <algorithm>
    20 #include <cassert>
    21 
    22 #include "TypeData.h"
    23 
    24 #include "SynTree/Attribute.h"
    25 #include "SynTree/Declaration.h"
    26 #include "SynTree/Expression.h"
    27 
    28 #include "TypedefTable.h"
     16#include <cassert>                 // for assert, assertf, safe_dynamic_cast
     17#include <iterator>                // for back_insert_iterator
     18#include <list>                    // for list
     19#include <memory>                  // for unique_ptr
     20#include <ostream>                 // for operator<<, ostream, basic_ostream
     21#include <string>                  // for string, operator+, allocator, char...
     22
     23#include "Common/SemanticError.h"  // for SemanticError
     24#include "Common/UniqueName.h"     // for UniqueName
     25#include "Common/utility.h"        // for maybeClone, maybeBuild, CodeLocation
     26#include "Parser/LinkageSpec.h"    // for Spec, linkageName, Cforall
     27#include "Parser/ParseNode.h"      // for DeclarationNode, ExpressionNode
     28#include "SynTree/Attribute.h"     // for Attribute
     29#include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, Declaration
     30#include "SynTree/Expression.h"    // for Expression, ConstantExpr
     31#include "SynTree/Statement.h"     // for AsmStmt
     32#include "SynTree/Type.h"          // for Type, Type::StorageClasses, Type::...
     33#include "TypeData.h"              // for TypeData, TypeData::Aggregate_t
     34#include "TypedefTable.h"          // for TypedefTable, TypedefTable::kind_t...
     35
     36class Initializer;
     37
    2938extern TypedefTable typedefTable;
    3039
  • src/Parser/ExpressionNode.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <climits>                                                                              // access INT_MAX, UINT_MAX, LONG_MAX, ULONG_MAX, LLONG_MAX
    17 #include <sstream>
    18 
    19 #include "ParseNode.h"
    20 #include "TypeData.h"
    21 #include "SynTree/Constant.h"
    22 #include "SynTree/Expression.h"
    23 #include "SynTree/Declaration.h"
    24 #include "parserutility.h"
     16#include <cassert>                 // for assert
     17#include <stdio.h>                 // for sscanf, size_t
     18#include <climits>                 // for LLONG_MAX, LONG_MAX, INT_MAX, UINT...
     19#include <list>                    // for list
     20#include <sstream>                 // for basic_istream::operator>>, basic_i...
     21#include <string>                  // for string, operator+, operator==
     22
     23#include "Common/SemanticError.h"  // for SemanticError
     24#include "Common/utility.h"        // for maybeMoveBuild, maybeBuild, CodeLo...
     25#include "ParseNode.h"             // for ExpressionNode, maybeMoveBuildType
     26#include "SynTree/Constant.h"      // for Constant
     27#include "SynTree/Declaration.h"   // for EnumDecl, StructDecl, UnionDecl
     28#include "SynTree/Expression.h"    // for Expression, ConstantExpr, NameExpr
     29#include "SynTree/Statement.h"     // for CompoundStmt, Statement
     30#include "SynTree/Type.h"          // for BasicType, Type, Type::Qualifiers
     31#include "parserutility.h"         // for notZeroExpr
     32
     33class Initializer;
    2534
    2635using namespace std;
     
    6978                goto CLEANUP;
    7079        } // if
    71        
     80
    7281        if ( str[0] == '0' ) {                                                          // octal/hex constant ?
    7382                dec = false;
  • src/Parser/InitializerNode.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
    17 #include <iostream>
     16#include <iostream>                // for operator<<, ostream, basic_ostream
     17#include <list>                    // for list
     18#include <string>                  // for operator<<, string
     19
    1820using namespace std;
    1921
    20 #include "ParseNode.h"
    21 #include "SynTree/Expression.h"
    22 #include "SynTree/Initializer.h"
     22#include "Common/SemanticError.h"  // for SemanticError
     23#include "Common/utility.h"        // for maybeBuild
     24#include "ParseNode.h"             // for InitializerNode, ExpressionNode
     25#include "SynTree/Expression.h"    // for Expression
     26#include "SynTree/Initializer.h"   // for Initializer, ListInit, SingleInit
    2327
    2428InitializerNode::InitializerNode( ExpressionNode * _expr, bool aggrp, ExpressionNode * des )
  • src/Parser/ParseNode.h

    rfc56cdbf r8135d4c  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Aug 10 16:54:00 2017
    13 // Update Count     : 789
     12// Last Modified On : Thr Aug 17 13:46:00 2017
     13// Update Count     : 795
    1414//
    1515
    1616#pragma once
    1717
    18 #include <string>
    19 #include <list>
    20 #include <iterator>
    21 #include <memory>
    22 
    23 #include "Parser/LinkageSpec.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/Expression.h"
    26 #include "SynTree/Statement.h"
    27 #include "SynTree/Label.h"
    28 #include "Common/utility.h"
    29 #include "Common/UniqueName.h"
    30 
     18#include <algorithm>               // for move
     19#include <cassert>                 // for assert, assertf
     20#include <iosfwd>                  // for ostream
     21#include <iterator>                // for back_insert_iterator
     22#include <list>                    // for list
     23#include <memory>                  // for unique_ptr, pointer_traits
     24#include <string>                  // for string
     25
     26#include "Common/CodeLocation.h"   // for CodeLocation
     27#include "Common/SemanticError.h"  // for SemanticError
     28#include "Common/UniqueName.h"     // for UniqueName
     29#include "Common/utility.h"        // for maybeClone, maybeBuild
     30#include "Parser/LinkageSpec.h"    // for Spec
     31#include "SynTree/Expression.h"    // for Expression, ConstantExpr (ptr only)
     32#include "SynTree/Label.h"         // for Label
     33#include "SynTree/Statement.h"     // for Statement, BranchStmt, BranchStmt:...
     34#include "SynTree/Type.h"          // for Type, Type::FuncSpecifiers, Type::...
     35
     36class Attribute;
     37class Declaration;
     38class DeclarationNode;
     39class DeclarationWithType;
     40class ExpressionNode;
     41class Initializer;
    3142class StatementNode;
    32 class CompoundStmtNode;
    33 class DeclarationNode;
    34 class ExpressionNode;
    35 class InitializerNode;
    36 class Attribute;
    3743
    3844//##############################################################################
     
    371377Statement * build_expr( ExpressionNode * ctl );
    372378
     379struct IfCtl {
     380        IfCtl( DeclarationNode * decl, ExpressionNode * condition ) :
     381                init( decl ? new StatementNode( decl ) : nullptr ), condition( condition ) {}
     382
     383        StatementNode * init;
     384        ExpressionNode * condition;
     385};
     386
    373387struct ForCtl {
    374388        ForCtl( ExpressionNode * expr, ExpressionNode * condition, ExpressionNode * change ) :
     
    382396};
    383397
    384 Statement * build_if( ExpressionNode * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
     398Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
    385399Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );
    386400Statement * build_case( ExpressionNode * ctl );
  • src/Parser/StatementNode.cc

    rfc56cdbf r8135d4c  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 11 21:23:15 2017
    13 // Update Count     : 331
    14 //
    15 
    16 #include <list>
    17 #include <algorithm>
    18 #include <cassert>
    19 
    20 #include "ParseNode.h"
    21 #include "SynTree/Statement.h"
    22 #include "SynTree/Expression.h"
    23 #include "parserutility.h"
    24 #include "Common/utility.h"
     12// Last Modified On : Thu Aug 17 16:01:31 2017
     13// Update Count     : 345
     14//
     15
     16#include <cassert>                 // for assert, safe_dynamic_cast, assertf
     17#include <list>                    // for list
     18#include <memory>                  // for unique_ptr
     19#include <string>                  // for string
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "Common/utility.h"        // for maybeMoveBuild, maybeBuild
     23#include "ParseNode.h"             // for StatementNode, ExpressionNode, bui...
     24#include "SynTree/Expression.h"    // for Expression, ConstantExpr
     25#include "SynTree/Label.h"         // for Label, noLabels
     26#include "SynTree/Declaration.h"
     27#include "SynTree/Statement.h"     // for Statement, BranchStmt, CaseStmt
     28#include "parserutility.h"         // for notZeroExpr
     29
     30class Declaration;
    2531
    2632using namespace std;
     
    7480}
    7581
    76 Statement *build_if( ExpressionNode *ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
     82Statement *build_if( IfCtl * ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
    7783        Statement *thenb, *elseb = 0;
    7884        std::list< Statement * > branches;
     
    8793                elseb = branches.front();
    8894        } // if
    89         return new IfStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), thenb, elseb );
     95       
     96        std::list< Statement * > init;
     97        if ( ctl->init != 0 ) {
     98                buildMoveList( ctl->init, init );
     99        } // if
     100
     101        Expression * cond = ctl->condition ? maybeMoveBuild< Expression >(ctl->condition) : new VariableExpr( dynamic_cast<DeclarationWithType *>( dynamic_cast<DeclStmt *>( init.back() )->decl ) );
     102        delete ctl;
     103        return new IfStmt( noLabels, notZeroExpr( cond ), thenb, elseb, init );
    90104}
    91105
  • src/Parser/TypeData.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
    17 #include <algorithm>
    18 #include <iterator>
    19 #include "Common/utility.h"
     16#include <cassert>                 // for assert
     17#include <ostream>                 // for operator<<, ostream, basic_ostream
     18
     19#include "Common/SemanticError.h"  // for SemanticError
     20#include "Common/utility.h"        // for maybeClone, maybeBuild, maybeMoveB...
     21#include "Parser/ParseNode.h"      // for DeclarationNode, ExpressionNode
     22#include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, FunctionDecl
     23#include "SynTree/Expression.h"    // for Expression, ConstantExpr (ptr only)
     24#include "SynTree/Initializer.h"   // for SingleInit, Initializer (ptr only)
     25#include "SynTree/Statement.h"     // for CompoundStmt, Statement
     26#include "SynTree/Type.h"          // for BasicType, Type, Type::ForallList
    2027#include "TypeData.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Expression.h"
    24 #include "SynTree/Statement.h"
    25 #include "SynTree/Initializer.h"
     28
     29class Attribute;
     30
    2631using namespace std;
    2732
  • src/Parser/TypeData.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "ParseNode.h"
    19 #include "SynTree/Type.h"
     18#include <iosfwd>                // for ostream
     19#include <list>                  // for list
     20#include <string>                // for string
     21
     22#include "ParseNode.h"           // for DeclarationNode, DeclarationNode::Ag...
     23#include "Parser/LinkageSpec.h"  // for Spec
     24#include "SynTree/Type.h"        // for Type, ReferenceToType (ptr only)
     25#include "SynTree/SynTree.h"     // for Visitor Nodes
    2026
    2127struct TypeData {
  • src/Parser/TypedefTable.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <map>
    17 #include <list>
    18 #include <cassert>
     16#include <ext/alloc_traits.h>    // for __alloc_traits<>::value_type
     17#include <cassert>               // for assert
     18#include <list>                  // for list, _List_iterator, list<>::iterator
     19#include <map>                   // for _Rb_tree_iterator, _Rb_tree_const_it...
     20#include <memory>                // for allocator_traits<>::value_type
     21#include <utility>               // for pair
     22
     23#include "Parser/ParserTypes.h"  // for typedefTable
     24#include "Parser/parser.hh"      // for IDENTIFIER
    1925#include "TypedefTable.h"
     26
    2027using namespace std;
    2128
    2229#if 0
    2330#include <iostream>
     31
    2432#define debugPrint( x ) cerr << x
    2533#else
  • src/Parser/TypedefTable.h

    rfc56cdbf r8135d4c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TypedefTable.h -- 
     7// TypedefTable.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    1616#pragma once
    1717
    18 #include <map>
    19 #include <list>
    20 #include <string>
    21 #include <stack>
     18#include <list>       // for list
     19#include <map>        // for map, map<>::value_compare
     20#include <stack>      // for stack
     21#include <string>     // for string
    2222
    2323#include "ParserTypes.h"
    24 #include "parser.hh"
     24#include "parser.hh"  // for IDENTIFIER, TYPEDEFname, TYPEGENname
    2525
    2626class TypedefTable {
     
    3232                kind_t kind;
    3333        };
    34        
     34
    3535        struct DeferredEntry {
    3636                std::string identifier;
     
    4444        std::string currentTrait;
    4545        int contextScope;
    46        
     46
    4747        typedef std::list< DeferredEntry > deferListType;
    4848        std::stack< deferListType > deferListStack;
    4949        std::map< std::string, deferListType > contexts;
    50        
     50
    5151        std::stack< std::string > nextIdentifiers;
    5252
     
    7070        void addToEnclosingScope( const std::string &identifier, kind_t kind );
    7171        void addToEnclosingScope( kind_t kind );                // use nextIdentifiers.top()
    72        
     72
    7373        // "addToEnclosingScope2" adds the identifier/type pair to the scope that encloses the scope enclosing the the
    7474        // current one.  This is the right way to handle assertion names
    7575        void addToEnclosingScope2( const std::string &identifier, kind_t kind );
    7676        void addToEnclosingScope2( kind_t kind );               // use nextIdentifiers.top()
    77        
     77
    7878        // set the next identifier to be used by an "add" operation without an identifier parameter within the current scope
    7979        void setNextIdentifier( const std::string &identifier );
    80        
     80
    8181        // dump the definitions from a pre-defined context into the current scope
    8282        void openTrait( const std::string &contextName );
    83        
     83
    8484        void enterScope();
    8585        void leaveScope();
  • src/Parser/parser.yy

    rfc56cdbf r8135d4c  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  4 13:33:00 2017
    13 // Update Count     : 2475
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Aug 20 09:21:54 2017
     13// Update Count     : 2573
    1414//
    1515
     
    9898        StatementNode * sn;
    9999        ConstantExpr * constant;
     100        IfCtl * ifctl;
    100101        ForCtl * fctl;
    101102        LabelNode * label;
     
    130131%token ATTRIBUTE EXTENSION                                                              // GCC
    131132%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    132 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH   // CFA
     133%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH // CFA
    133134%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    134135%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    175176%type<en> comma_expression                              comma_expression_opt
    176177%type<en> argument_expression_list              argument_expression                     default_initialize_opt
     178%type<ifctl> if_control_expression
    177179%type<fctl> for_control_expression
    178180%type<en> subrange
     
    794796
    795797selection_statement:
    796         IF '(' comma_expression ')' statement                           %prec THEN
     798        IF '(' push if_control_expression ')' statement                         %prec THEN
    797799                // explicitly deal with the shift/reduce conflict on if/else
    798                 { $$ = new StatementNode( build_if( $3, $5, nullptr ) ); }
    799         | IF '(' comma_expression ')' statement ELSE statement
    800                 { $$ = new StatementNode( build_if( $3, $5, $7 ) ); }
    801         | SWITCH '(' comma_expression ')' case_clause           // CFA
     800                { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); }
     801        | IF '(' push if_control_expression ')' statement ELSE statement
     802                { $$ = new StatementNode( build_if( $4, $6, $8 ) ); }
     803        | SWITCH '(' comma_expression ')' case_clause
    802804                { $$ = new StatementNode( build_switch( $3, $5 ) ); }
    803805        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
     
    819821                }
    820822        ;
     823
     824if_control_expression:
     825        comma_expression pop
     826                { $$ = new IfCtl( nullptr, $1 ); }
     827        | c_declaration pop                                                                     // no semi-colon
     828                { $$ = new IfCtl( $1, nullptr ); }
     829        | cfa_declaration pop                                                           // no semi-colon
     830                { $$ = new IfCtl( $1, nullptr ); }
     831        | declaration comma_expression                                          // semi-colon separated
     832                { $$ = new IfCtl( $1, $2 ); }
     833        ;
    821834
    822835// CASE and DEFAULT clauses are only allowed in the SWITCH statement, precluding Duff's device. In addition, a case
     
    10911104
    10921105KR_declaration_list_opt:                                                                // used to declare parameter types in K&R style functions
    1093         pop
     1106        // empty
    10941107                { $$ = nullptr; }
    10951108        | KR_declaration_list
     
    10971110
    10981111KR_declaration_list:
    1099         c_declaration
    1100         | KR_declaration_list push c_declaration
     1112        push c_declaration pop ';'
     1113                { $$ = $2; }
     1114        | KR_declaration_list push c_declaration pop ';'
    11011115                { $$ = $1->appendList( $3 ); }
    11021116        ;
     
    11171131        ;
    11181132
    1119 declaration:                                                                                    // CFA, new & old style declarations
    1120         cfa_declaration
    1121         | c_declaration
     1133declaration:                                                                                    // old & new style declarations
     1134        c_declaration pop ';'
     1135        | cfa_declaration pop ';'                                                       // CFA
    11221136        ;
    11231137
     
    11341148
    11351149cfa_declaration:                                                                                // CFA
    1136         cfa_variable_declaration pop ';'
    1137         | cfa_typedef_declaration pop ';'
    1138         | cfa_function_declaration pop ';'
    1139         | type_declaring_list pop ';'
    1140         | trait_specifier pop ';'
     1150        cfa_variable_declaration
     1151        | cfa_typedef_declaration
     1152        | cfa_function_declaration
     1153        | type_declaring_list
     1154        | trait_specifier
    11411155        ;
    11421156
     
    13381352
    13391353c_declaration:
    1340         declaration_specifier declaring_list pop ';'
     1354        declaration_specifier declaring_list
    13411355                {
    13421356                        $$ = distAttr( $1, $2 );
    13431357                }
    1344         | typedef_declaration pop ';'
    1345         | typedef_expression pop ';'                                            // GCC, naming expression type
    1346         | sue_declaration_specifier pop ';'
     1358        | typedef_declaration
     1359        | typedef_expression                                                            // GCC, naming expression type
     1360        | sue_declaration_specifier
    13471361        ;
    13481362
     
    22152229                        $$ = $1->addFunctionBody( $2 );
    22162230                }
    2217         | KR_function_declarator push KR_declaration_list_opt compound_statement
     2231        | KR_function_declarator KR_declaration_list_opt compound_statement
    22182232                {
    22192233                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22202234                        typedefTable.leaveScope();
    2221                         $$ = $1->addOldDeclList( $3 )->addFunctionBody( $4 );
     2235                        $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 );
    22222236                }
    22232237        ;
     
    22632277
    22642278                // Old-style K&R function definition, OBSOLESCENT (see 4)
    2265         | declaration_specifier KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2279        | declaration_specifier KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    22662280                {
    22672281                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22682282                        typedefTable.leaveScope();
    2269                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addType( $1 );
    2270                 }
    2271         | type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2283                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addType( $1 );
     2284                }
     2285        | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    22722286                {
    22732287                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22742288                        typedefTable.leaveScope();
    2275                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
     2289                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 );
    22762290                }
    22772291
    22782292                // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4)
    2279         | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2293        | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    22802294                {
    22812295                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22822296                        typedefTable.leaveScope();
    2283                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
    2284                 }
    2285         | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2297                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 );
     2298                }
     2299        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    22862300                {
    22872301                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22882302                        typedefTable.leaveScope();
    2289                         $$ = $3->addOldDeclList( $5 )->addFunctionBody( $7 )->addQualifiers( $2 )->addQualifiers( $1 );
     2303                        $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $2 )->addQualifiers( $1 );
    22902304                }
    22912305        ;
  • src/Parser/parserutility.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "parserutility.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Expression.h"
     17
     18#include <list>                  // for list
     19#include <string>                // for string
     20
     21#include "SynTree/Constant.h"    // for Constant
     22#include "SynTree/Expression.h"  // for UntypedExpr, CastExpr, ConstantExpr
     23#include "SynTree/Type.h"        // for BasicType, ZeroType, BasicType::Kind...
    1924
    2025// rewrite
  • src/Parser/parserutility.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
     18class Expression;
    1919
    2020Expression *notZeroExpr( Expression *orig );
  • src/ResolvExpr/AdjustExprType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "SynTree/Type.h"
    18 #include "TypeEnvironment.h"
    19 #include "SymTab/Indexer.h"
     16#include "SymTab/Indexer.h"       // for Indexer
     17#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Kind::Ftype
     18#include "SynTree/Mutator.h"      // for Mutator
     19#include "SynTree/Type.h"         // for PointerType, TypeInstType, Type
     20#include "TypeEnvironment.h"      // for EqvClass, TypeEnvironment
    2021
    2122namespace ResolvExpr {
  • src/ResolvExpr/Alternative.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "Alternative.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Expression.h"
    19 #include "Common/utility.h"
     17
     18#include <ostream>                       // for operator<<, ostream, basic_o...
     19#include <string>                        // for operator<<, char_traits, string
     20
     21#include "Common/utility.h"              // for maybeClone
     22#include "ResolvExpr/Cost.h"             // for Cost, Cost::zero, operator<<
     23#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
     24#include "SynTree/Expression.h"          // for Expression
     25#include "SynTree/Type.h"                // for Type
    2026
    2127namespace ResolvExpr {
  • src/ResolvExpr/Alternative.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include "SynTree/SynTree.h"
    20 #include "Cost.h"
    21 #include "TypeEnvironment.h"
     18#include <iosfwd>             // for ostream
     19#include <list>               // for list
     20
     21#include "Cost.h"             // for Cost
     22#include "TypeEnvironment.h"  // for TypeEnvironment
     23
     24class Expression;
    2225
    2326namespace ResolvExpr {
    2427        struct Alternative;
     28
    2529        typedef std::list< Alternative > AltList;
    2630
  • src/ResolvExpr/AlternativeFinder.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <list>
    17 #include <iterator>
    18 #include <algorithm>
    19 #include <functional>
    20 #include <cassert>
    21 #include <unordered_map>
    22 #include <utility>
    23 #include <vector>
    24 
     16#include <algorithm>               // for copy
     17#include <cassert>                 // for safe_dynamic_cast, assert, assertf
     18#include <iostream>                // for operator<<, cerr, ostream, endl
     19#include <iterator>                // for back_insert_iterator, back_inserter
     20#include <list>                    // for _List_iterator, list, _List_const_...
     21#include <map>                     // for _Rb_tree_iterator, map, _Rb_tree_c...
     22#include <memory>                  // for allocator_traits<>::value_type
     23#include <utility>                 // for pair
     24
     25#include "Alternative.h"           // for AltList, Alternative
    2526#include "AlternativeFinder.h"
    26 #include "Alternative.h"
    27 #include "Cost.h"
    28 #include "typeops.h"
    29 #include "Unify.h"
    30 #include "RenameVars.h"
    31 #include "SynTree/Type.h"
    32 #include "SynTree/Declaration.h"
    33 #include "SynTree/Expression.h"
    34 #include "SynTree/Initializer.h"
    35 #include "SynTree/Visitor.h"
    36 #include "SymTab/Indexer.h"
    37 #include "SymTab/Mangler.h"
    38 #include "SynTree/TypeSubstitution.h"
    39 #include "SymTab/Validate.h"
    40 #include "Tuples/Tuples.h"
    41 #include "Tuples/Explode.h"
    42 #include "Common/utility.h"
    43 #include "InitTweak/InitTweak.h"
    44 #include "InitTweak/GenInit.h"
    45 #include "ResolveTypeof.h"
    46 #include "Resolver.h"
     27#include "Common/SemanticError.h"  // for SemanticError
     28#include "Common/utility.h"        // for deleteAll, printAll, CodeLocation
     29#include "Cost.h"                  // for Cost, Cost::zero, operator<<, Cost...
     30#include "InitTweak/InitTweak.h"   // for getFunctionName
     31#include "RenameVars.h"            // for RenameVars, global_renamer
     32#include "ResolveTypeof.h"         // for resolveTypeof
     33#include "Resolver.h"              // for resolveStmtExpr
     34#include "SymTab/Indexer.h"        // for Indexer
     35#include "SymTab/Mangler.h"        // for Mangler
     36#include "SymTab/Validate.h"       // for validateType
     37#include "SynTree/Constant.h"      // for Constant
     38#include "SynTree/Declaration.h"   // for DeclarationWithType, TypeDecl, Dec...
     39#include "SynTree/Expression.h"    // for Expression, CastExpr, NameExpr
     40#include "SynTree/Initializer.h"   // for SingleInit, operator<<, Designation
     41#include "SynTree/SynTree.h"       // for UniqueId
     42#include "SynTree/Type.h"          // for Type, FunctionType, PointerType
     43#include "Tuples/Explode.h"        // for explode
     44#include "Tuples/Tuples.h"         // for isTtype, handleTupleAssignment
     45#include "Unify.h"                 // for unify
     46#include "typeops.h"               // for adjustExprType, polyCost, castCost
    4747
    4848extern bool resolvep;
     
    979979        void AlternativeFinder::visit( SizeofExpr *sizeofExpr ) {
    980980                if ( sizeofExpr->get_isType() ) {
    981                         // xxx - resolveTypeof?
    982                         alternatives.push_back( Alternative( sizeofExpr->clone(), env, Cost::zero ) );
     981                        Type * newType = sizeofExpr->get_type()->clone();
     982                        alternatives.push_back( Alternative( new SizeofExpr( resolveTypeof( newType, indexer ) ), env, Cost::zero ) );
    983983                } else {
    984984                        // find all alternatives for the argument to sizeof
     
    10001000        void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {
    10011001                if ( alignofExpr->get_isType() ) {
    1002                         // xxx - resolveTypeof?
    1003                         alternatives.push_back( Alternative( alignofExpr->clone(), env, Cost::zero ) );
     1002                        Type * newType = alignofExpr->get_type()->clone();
     1003                        alternatives.push_back( Alternative( new AlignofExpr( resolveTypeof( newType, indexer ) ), env, Cost::zero ) );
    10041004                } else {
    10051005                        // find all alternatives for the argument to sizeof
  • src/ResolvExpr/AlternativeFinder.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <set>
     18#include <algorithm>                     // for copy
     19#include <list>                          // for list
     20#include <string>                        // for string
    1921
    20 #include "Alternative.h"
    21 #include "Unify.h"
    22 #include "SynTree/SynTree.h"
    23 #include "SymTab/Indexer.h"
    24 #include "SynTree/TypeSubstitution.h"
     22#include "Alternative.h"                 // for AltList, Alternative
     23#include "ResolvExpr/Cost.h"             // for Cost, Cost::infinity
     24#include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
     25#include "SynTree/Visitor.h"             // for Visitor
     26#include "SynTree/SynTree.h"             // for Visitor Nodes
     27
     28namespace SymTab {
     29class Indexer;
     30}  // namespace SymTab
    2531
    2632namespace ResolvExpr {
  • src/ResolvExpr/AlternativePrinter.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "AlternativePrinter.h"
    17 #include "AlternativeFinder.h"
    18 #include "Alternative.h"
    19 #include "SynTree/Statement.h"
    20 #include "SynTree/Type.h"
    21 #include "SynTree/Expression.h"
    22 #include "Common/utility.h"
     17
     18#include <list>                          // for _List_const_iterator, list<>...
     19
     20#include "Alternative.h"                 // for AltList, Alternative
     21#include "AlternativeFinder.h"           // for AlternativeFinder
     22#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
     23#include "SynTree/Expression.h"          // for Expression
     24#include "SynTree/Statement.h"           // for ExprStmt
     25#include "SynTree/Type.h"                // for Type
    2326
    2427namespace ResolvExpr {
  • src/ResolvExpr/AlternativePrinter.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <iostream>
     18#include <iostream>          // for ostream
    1919
    20 #include "Alternative.h"
    21 #include "SymTab/Indexer.h"
     20#include "SymTab/Indexer.h"  // for Indexer
     21
     22class ExprStmt;
    2223
    2324namespace ResolvExpr {
  • src/ResolvExpr/CastCost.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "Cost.h"
    18 #include "ConversionCost.h"
    19 #include "SynTree/Type.h"
    20 #include "SynTree/Visitor.h"
    21 #include "SymTab/Indexer.h"
     16#include <cassert>                       // for assert
     17
     18#include "ConversionCost.h"              // for ConversionCost
     19#include "Cost.h"                        // for Cost, Cost::infinity
     20#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment, EqvClass
     21#include "SymTab/Indexer.h"              // for Indexer
     22#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl
     23#include "SynTree/Type.h"                // for PointerType, Type, TypeInstType
     24#include "typeops.h"                     // for typesCompatibleIgnoreQualifiers
    2225
    2326
  • src/ResolvExpr/CommonType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "SynTree/Type.h"
    18 #include "Unify.h"
     16#include <cassert>                       // for safe_dynamic_cast
     17#include <map>                           // for _Rb_tree_const_iterator
     18#include <utility>                       // for pair
     19
     20#include "ResolvExpr/TypeEnvironment.h"  // for OpenVarSet, AssertionSet
     21#include "SymTab/Indexer.h"              // for Indexer
     22#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl (ptr...
     23#include "SynTree/Type.h"                // for BasicType, BasicType::Kind::...
     24#include "SynTree/Visitor.h"             // for Visitor
     25#include "Unify.h"                       // for unifyExact, bindVar, WidenMode
     26#include "typeops.h"                     // for isFtype
    1927
    2028// #define DEBUG
  • src/ResolvExpr/ConversionCost.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "ConversionCost.h"
    17 #include "typeops.h"
    18 #include "SynTree/Type.h"
    19 #include "SynTree/Visitor.h"
    20 #include "SymTab/Indexer.h"
     17
     18#include <cassert>                       // for assert
     19#include <list>                          // for list, list<>::const_iterator
     20#include <string>                        // for operator==, string
     21
     22#include "ResolvExpr/Cost.h"             // for Cost
     23#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
     24#include "SymTab/Indexer.h"              // for Indexer
     25#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl
     26#include "SynTree/Type.h"                // for Type, BasicType, TypeInstType
     27#include "typeops.h"                     // for typesCompatibleIgnoreQualifiers
    2128
    2229namespace ResolvExpr {
  • src/ResolvExpr/ConversionCost.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/Visitor.h"
    19 #include "SymTab/Indexer.h"
    20 #include "Cost.h"
    21 #include "TypeEnvironment.h"
     18#include "Cost.h"             // for Cost
     19#include "SynTree/Visitor.h"  // for Visitor
     20#include "SynTree/SynTree.h"  // for Visitor Nodes
     21
     22namespace SymTab {
     23class Indexer;
     24}  // namespace SymTab
    2225
    2326namespace ResolvExpr {
     27class TypeEnvironment;
     28
    2429        class ConversionCost : public Visitor {
    2530          public:
  • src/ResolvExpr/CurrentObject.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <stack>
    17 #include <iostream>
    18 
     16#include <stddef.h>                    // for size_t
     17#include <cassert>                     // for assertf, assert, safe_dynamic_...
     18#include <iostream>                    // for ostream, operator<<, basic_ost...
     19#include <stack>                       // for stack
     20#include <string>                      // for string, operator<<, allocator
     21
     22#include "Common/Indenter.h"           // for Indenter, operator<<
     23#include "Common/SemanticError.h"      // for SemanticError
     24#include "Common/utility.h"            // for toString
    1925#include "CurrentObject.h"
    20 
    21 #include "Common/Indenter.h"
    22 
    23 #include "SynTree/Declaration.h"
    24 #include "SynTree/Initializer.h"
    25 #include "SynTree/Type.h"
    26 #include "SynTree/TypeSubstitution.h"
     26#include "SynTree/Constant.h"          // for Constant
     27#include "SynTree/Declaration.h"       // for ObjectDecl, Declaration, Struc...
     28#include "SynTree/Expression.h"        // for InitAlternative, VariableExpr
     29#include "SynTree/Initializer.h"       // for Designation, operator<<
     30#include "SynTree/Type.h"              // for Type, StructInstType, UnionIns...
     31#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
    2732
    2833#if 0
  • src/ResolvExpr/CurrentObject.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <stack>
     18#include <list>   // for list
     19#include <stack>  // for stack
    1920
    20 #include "SynTree/SynTree.h"
    21 #include "SynTree/Expression.h"
     21class Designation;
     22class Type;
     23struct InitAlternative;
    2224
    2325namespace ResolvExpr {
  • src/ResolvExpr/FindOpenVars.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "FindOpenVars.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Visitor.h"
     17
     18#include <list>                   // for _List_const_iterator, list<>::const...
     19#include <map>                    // for map<>::mapped_type
     20
     21#include "SynTree/Declaration.h"  // for TypeDecl, DeclarationWithType (ptr ...
     22#include "SynTree/Type.h"         // for Type, Type::ForallList, ArrayType
     23#include "SynTree/Visitor.h"      // for Visitor
    1924
    2025namespace ResolvExpr {
  • src/ResolvExpr/FindOpenVars.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "Unify.h"
    19 #include "SynTree/SynTree.h"
     18#include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
     19
     20class Type;
    2021
    2122namespace ResolvExpr {
  • src/ResolvExpr/Occurs.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <set>
    17 #include <algorithm>
    18 #include <iterator>
    19 #include "SynTree/Type.h"
    20 #include "SynTree/Visitor.h"
    21 #include "TypeEnvironment.h"
     16#include <set>                // for set, _Rb_tree_const_iterator
     17#include <string>             // for string
     18
     19#include "SynTree/Type.h"     // for TypeInstType, Type
     20#include "SynTree/Visitor.h"  // for Visitor
     21#include "TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    2222
    2323namespace ResolvExpr {
  • src/ResolvExpr/PolyCost.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Visitor.h"
    19 #include "SymTab/Indexer.h"
    20 #include "TypeEnvironment.h"
     16#include "SymTab/Indexer.h"   // for Indexer
     17#include "SynTree/Type.h"     // for TypeInstType, Type
     18#include "SynTree/Visitor.h"  // for Visitor
     19#include "TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    2120
    2221namespace ResolvExpr {
  • src/ResolvExpr/PtrsAssignable.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Visitor.h"
     16#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
     17#include "SynTree/Type.h"                // for TypeInstType, Type, BasicType
     18#include "SynTree/Visitor.h"             // for Visitor
    2019
    2120
  • src/ResolvExpr/PtrsCastable.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "typeops.h"
    17 #include "SynTree/Type.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Visitor.h"
    20 #include "SymTab/Indexer.h"
     16#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
     17#include "SymTab/Indexer.h"              // for Indexer
     18#include "SynTree/Declaration.h"         // for TypeDecl, TypeDecl::Kind::Ftype
     19#include "SynTree/Type.h"                // for TypeInstType, Type, BasicType
     20#include "SynTree/Visitor.h"             // for Visitor
     21#include "typeops.h"                     // for ptrsAssignable
    2122
    2223
  • src/ResolvExpr/RenameVars.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <sstream>
     16#include <ext/alloc_traits.h>      // for __alloc_traits<>::value_type
     17#include <memory>                  // for allocator_traits<>::value_type
     18#include <sstream>                 // for operator<<, basic_ostream, ostring...
     19#include <utility>                 // for pair
    1720
     21#include "Common/SemanticError.h"  // for SemanticError
    1822#include "RenameVars.h"
    19 #include "SynTree/Visitor.h"
    20 #include "SynTree/Type.h"
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/Expression.h"
     23#include "SynTree/Declaration.h"   // for DeclarationWithType, TypeDecl, Dec...
     24#include "SynTree/Expression.h"    // for Expression
     25#include "SynTree/Type.h"          // for Type, TypeInstType, TraitInstType
     26#include "SynTree/Visitor.h"       // for acceptAll, maybeAccept
    2327
    2428namespace ResolvExpr {
  • src/ResolvExpr/RenameVars.h

    rfc56cdbf r8135d4c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // RenameVars.h -- 
     7// RenameVars.h --
    88//
    99// Author           : Richard C. Bilson
     
    1616#pragma once
    1717
    18 #include <list>
    19 #include <map>
    20 #include <string>
     18#include <list>               // for list
     19#include <map>                // for map
     20#include <string>             // for string
    2121
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Visitor.h"
     22#include "SynTree/SynTree.h"  // for Visitor Nodes
     23#include "SynTree/Visitor.h"  // for Visitor
    2424
    2525namespace ResolvExpr {
  • src/ResolvExpr/ResolveTypeof.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "ResolveTypeof.h"
    17 #include "Alternative.h"
    18 #include "AlternativeFinder.h"
    19 #include "Resolver.h"
    20 #include "TypeEnvironment.h"
    21 #include "SynTree/Expression.h"
    22 #include "SynTree/Type.h"
     17
     18#include <cassert>               // for assert
     19
     20#include "Resolver.h"            // for resolveInVoidContext
     21#include "SynTree/Expression.h"  // for Expression
     22#include "SynTree/Mutator.h"     // for Mutator
     23#include "SynTree/Type.h"        // for TypeofType, Type
     24
     25namespace SymTab {
     26class Indexer;
     27}  // namespace SymTab
    2328
    2429namespace ResolvExpr {
  • src/ResolvExpr/ResolveTypeof.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
    19 #include "SymTab/Indexer.h"
     18class Type;
     19namespace SymTab {
     20class Indexer;
     21}  // namespace SymTab
    2022
    2123namespace ResolvExpr {
  • src/ResolvExpr/Resolver.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <iostream>
    17 
    18 #include "Alternative.h"
    19 #include "AlternativeFinder.h"
    20 #include "CurrentObject.h"
    21 #include "RenameVars.h"
     16#include <stddef.h>                      // for NULL
     17#include <cassert>                       // for safe_dynamic_cast, assert
     18#include <memory>                        // for allocator, allocator_traits<...
     19#include <tuple>                         // for get
     20
     21#include "Alternative.h"                 // for Alternative, AltList
     22#include "AlternativeFinder.h"           // for AlternativeFinder, resolveIn...
     23#include "Common/SemanticError.h"        // for SemanticError
     24#include "Common/utility.h"              // for ValueGuard, group_iterate
     25#include "CurrentObject.h"               // for CurrentObject
     26#include "InitTweak/InitTweak.h"         // for isIntrinsicSingleArgCallStmt
     27#include "RenameVars.h"                  // for RenameVars, global_renamer
     28#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
     29#include "ResolveTypeof.h"               // for resolveTypeof
    2230#include "Resolver.h"
    23 #include "ResolveTypeof.h"
    24 #include "typeops.h"
    25 
    26 #include "SynTree/Expression.h"
    27 #include "SynTree/Initializer.h"
    28 #include "SynTree/Statement.h"
    29 #include "SynTree/Type.h"
    30 
    31 #include "SymTab/Autogen.h"
    32 #include "SymTab/Indexer.h"
    33 
    34 #include "Common/utility.h"
    35 
    36 #include "InitTweak/InitTweak.h"
     31#include "SymTab/Autogen.h"              // for SizeType
     32#include "SymTab/Indexer.h"              // for Indexer
     33#include "SynTree/Declaration.h"         // for ObjectDecl, TypeDecl, Declar...
     34#include "SynTree/Expression.h"          // for Expression, CastExpr, InitExpr
     35#include "SynTree/Initializer.h"         // for ConstructorInit, SingleInit
     36#include "SynTree/Statement.h"           // for ForStmt, Statement, BranchStmt
     37#include "SynTree/Type.h"                // for Type, BasicType, PointerType
     38#include "SynTree/TypeSubstitution.h"    // for TypeSubstitution
     39#include "SynTree/Visitor.h"             // for acceptAll, maybeAccept
     40#include "typeops.h"                     // for extractResultType
    3741
    3842using namespace std;
     
    390394
    391395        void Resolver::visit( CatchStmt *catchStmt ) {
     396                // inline Indexer::visit so that the exception variable is still in-scope for
     397                // findSingleExpression() below
     398                Parent::enterScope();
     399                Visitor::visit( catchStmt );
     400               
    392401                if ( catchStmt->get_cond() ) {
    393402                        Expression * wrapped = new CastExpr(
     
    397406                        catchStmt->set_cond( findSingleExpression( wrapped, *this ) );
    398407                }
     408
     409                Parent::leaveScope();
    399410        }
    400411
  • src/ResolvExpr/Resolver.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree/SynTree.h"
    19 #include "SymTab/Indexer.h"
     18#include <list>  // for list
     19
     20class ConstructorInit;
     21class Declaration;
     22class Expression;
     23class StmtExpr;
     24namespace SymTab {
     25class Indexer;
     26}  // namespace SymTab
    2027
    2128namespace ResolvExpr {
  • src/ResolvExpr/TypeEnvironment.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iterator>
    18 
     16#include <cassert>                     // for assert
     17#include <algorithm>                   // for copy, set_intersection
     18#include <iterator>                    // for ostream_iterator, insert_iterator
     19#include <utility>                     // for pair
     20
     21#include "Common/utility.h"            // for maybeClone
     22#include "SynTree/Type.h"              // for Type, FunctionType, Type::Fora...
     23#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
    1924#include "TypeEnvironment.h"
    20 #include "SynTree/Type.h"
    21 #include "SynTree/TypeSubstitution.h"
    22 #include "Common/utility.h"
    2325
    2426namespace ResolvExpr {
  • src/ResolvExpr/TypeEnvironment.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 #include <set>
    20 #include <list>
    21 #include <iostream>
     18#include <iostream>                    // for ostream
     19#include <list>                        // for list, list<>::iterator, list<>...
     20#include <map>                         // for map, map<>::value_compare
     21#include <set>                         // for set
     22#include <string>                      // for string
    2223
    23 #include "SynTree/SynTree.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/TypeSubstitution.h"
    26 #include "SynTree/Declaration.h"
     24#include "SynTree/Declaration.h"       // for TypeDecl::Data, DeclarationWit...
     25#include "SynTree/SynTree.h"           // for UniqueId
     26#include "SynTree/Type.h"              // for Type, Type::ForallList
     27#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
    2728
    2829namespace ResolvExpr {
  • src/ResolvExpr/Unify.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <set>
    17 #include <memory>
    18 
     16#include <cassert>                // for assertf, assert
     17#include <iterator>               // for back_insert_iterator, back_inserter
     18#include <map>                    // for _Rb_tree_const_iterator, _Rb_tree_i...
     19#include <memory>                 // for unique_ptr, auto_ptr
     20#include <set>                    // for set
     21#include <string>                 // for string, operator==, operator!=, bas...
     22#include <utility>                // for pair
     23
     24#include "FindOpenVars.h"         // for findOpenVars
     25#include "Parser/LinkageSpec.h"   // for C
     26#include "SynTree/Constant.h"     // for Constant
     27#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data, Declarati...
     28#include "SynTree/Expression.h"   // for TypeExpr, Expression, ConstantExpr
     29#include "SynTree/Mutator.h"      // for Mutator
     30#include "SynTree/Type.h"         // for Type, TypeInstType, FunctionType
     31#include "SynTree/Visitor.h"      // for Visitor
     32#include "Tuples/Tuples.h"        // for isTtype
     33#include "TypeEnvironment.h"      // for EqvClass, AssertionSet, OpenVarSet
    1934#include "Unify.h"
    20 #include "TypeEnvironment.h"
    21 #include "typeops.h"
    22 #include "FindOpenVars.h"
    23 #include "SynTree/Visitor.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/Declaration.h"
    26 #include "SymTab/Indexer.h"
    27 #include "Common/utility.h"
    28 #include "Tuples/Tuples.h"
     35#include "typeops.h"              // for flatten, occurs, commonType
     36
     37namespace SymTab {
     38class Indexer;
     39}  // namespace SymTab
    2940
    3041// #define DEBUG
  • src/ResolvExpr/Unify.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <map>
    19 #include <list>
    20 #include "SynTree/SynTree.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SymTab/Indexer.h"
    24 #include "TypeEnvironment.h"
    25 #include "Common/utility.h"
     18#include <list>                   // for list
     19
     20#include "Common/utility.h"       // for deleteAll
     21#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data
     22#include "TypeEnvironment.h"      // for AssertionSet, OpenVarSet
     23
     24class Type;
     25class TypeInstType;
     26namespace SymTab {
     27class Indexer;
     28}  // namespace SymTab
    2629
    2730namespace ResolvExpr {
  • src/SymTab/Autogen.cc

    rfc56cdbf r8135d4c  
    1616#include "Autogen.h"
    1717
     18#include <cstddef>                 // for NULL
    1819#include <algorithm>               // for count_if
    1920#include <cassert>                 // for safe_dynamic_cast, assert, assertf
     
    2122#include <list>                    // for list, _List_iterator, list<>::iter...
    2223#include <set>                     // for set, _Rb_tree_const_iterator
     24#include <utility>                 // for pair
    2325#include <vector>                  // for vector
    2426
  • src/SymTab/Autogen.h

    rfc56cdbf r8135d4c  
    1717
    1818#include <cassert>                // for assert
    19 #include <iterator>               // for back_insert_iterator, back_inserter
    20 #include <list>                   // for list
    21 #include <string>                 // for string, operator==
     19#include <string>                 // for string
    2220
    2321#include "Common/UniqueName.h"    // for UniqueName
    2422#include "InitTweak/InitTweak.h"  // for InitExpander
    25 #include "Parser/LinkageSpec.h"   // for C
    2623#include "SynTree/Constant.h"     // for Constant
    27 #include "SynTree/Declaration.h"  // for ObjectDecl, Declaration (ptr only)
    28 #include "SynTree/Expression.h"   // for UntypedExpr, NameExpr, VariableExpr
    29 #include "SynTree/Initializer.h"  // for SingleInit
    30 #include "SynTree/Label.h"        // for Label, noLabels
    31 #include "SynTree/Statement.h"    // for Statement (ptr only), CompoundStmt
     24#include "SynTree/Declaration.h"  // for DeclarationWithType, ObjectDecl
     25#include "SynTree/Expression.h"   // for NameExpr, ConstantExpr, UntypedExpr...
    3226#include "SynTree/Type.h"         // for Type, ArrayType, Type::Qualifiers
     27
     28class CompoundStmt;
     29class Statement;
    3330
    3431namespace SymTab {
  • src/SymTab/FixFunction.cc

    rfc56cdbf r8135d4c  
    2020#include "Common/utility.h"       // for maybeClone
    2121#include "SynTree/Declaration.h"  // for FunctionDecl, ObjectDecl, Declarati...
     22#include "SynTree/Expression.h"   // for Expression
    2223#include "SynTree/Type.h"         // for ArrayType, PointerType, Type, Basic...
    2324
  • src/SymTab/Indexer.cc

    rfc56cdbf r8135d4c  
    1010// Created On       : Sun May 17 21:37:33 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:38:47 2017
    13 // Update Count     : 19
     12// Last Modified On : Thu Aug 17 16:08:40 2017
     13// Update Count     : 20
    1414//
    1515
     
    355355        }
    356356
     357        void Indexer::visit( IfStmt *ifStmt ) {
     358            // for statements introduce a level of scope
     359            enterScope();
     360            Visitor::visit( ifStmt );
     361            leaveScope();
     362        }
     363
     364        void Indexer::visit( ForStmt *forStmt ) {
     365            // for statements introduce a level of scope
     366            enterScope();
     367            Visitor::visit( forStmt );
     368            leaveScope();
     369        }
     370
     371        void Indexer::visit( CatchStmt *catchStmt ) {
     372                // catch statements introduce a level of scope (for the caught exception)
     373                enterScope();
     374                Visitor::visit( catchStmt );
     375                leaveScope();
     376        }
    357377
    358378        void Indexer::visit( ApplicationExpr *applicationExpr ) {
     
    558578                leaveScope();
    559579        }
    560 
    561         void Indexer::visit( ForStmt *forStmt ) {
    562             // for statements introduce a level of scope
    563             enterScope();
    564             Visitor::visit( forStmt );
    565             leaveScope();
    566         }
    567 
    568 
    569580
    570581        void Indexer::lookupId( const std::string &id, std::list< DeclarationWithType* > &out ) const {
  • src/SymTab/Indexer.h

    rfc56cdbf r8135d4c  
    1010// Created On       : Sun May 17 21:38:55 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:46:34 2017
    13 // Update Count     : 7
     12// Last Modified On : Thu Aug 17 16:09:12 2017
     13// Update Count     : 8
    1414//
    1515
     
    4545
    4646                virtual void visit( CompoundStmt *compoundStmt );
     47                virtual void visit( IfStmt *ifStmt );
     48                virtual void visit( ForStmt *forStmt );
     49                virtual void visit( CatchStmt *catchStmt );
    4750
    4851                virtual void visit( ApplicationExpr *applicationExpr );
     
    8184                virtual void visit( StructInstType *contextInst );
    8285                virtual void visit( UnionInstType *contextInst );
    83 
    84                 virtual void visit( ForStmt *forStmt );
    8586
    8687                // when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer
  • src/SymTab/Mangler.cc

    rfc56cdbf r8135d4c  
    2020#include <iterator>                 // for ostream_iterator, back_insert_ite...
    2121#include <list>                     // for _List_iterator, list, _List_const...
    22 #include <string>                   // for string, operator<<, basic_string
     22#include <string>                   // for string, char_traits, operator<<
    2323
    2424#include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup
     25#include "Common/SemanticError.h"   // for SemanticError
    2526#include "Common/utility.h"         // for toString
    2627#include "Parser/LinkageSpec.h"     // for Spec, isOverridable, AutoGen, Int...
  • src/SymTab/Validate.cc

    rfc56cdbf r8135d4c  
    4040#include "Validate.h"
    4141
     42#include <cassert>                     // for assertf, assert
    4243#include <cstddef>                     // for size_t
    43 #include <algorithm>                   // for move, transform
    44 #include <cassert>                     // for safe_dynamic_cast, assertf
    45 #include <iterator>                    // for back_inserter, inserter, back_...
    46 #include <list>                        // for list, _List_iterator, list<>::...
    47 #include <map>                         // for _Rb_tree_iterator, map, map<>:...
    48 #include <memory>                      // for unique_ptr, allocator
    49 #include <string>                      // for string, operator+, operator==
    50 #include <tuple>                       // for get
    51 #include <utility>                     // for pair, make_pair
    52 
    53 #include "AddVisit.h"                  // for addVisit
    54 #include "Autogen.h"                   // for SizeType, autogenerateRoutines
     44#include <list>                        // for list
     45#include <string>                      // for string
     46#include <utility>                     // for pair
     47
    5548#include "CodeGen/CodeGenerator.h"     // for genName
    5649#include "CodeGen/OperatorTable.h"     // for isCtorDtor, isCtorDtorAssign
    5750#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    58 #include "Common/ScopedMap.h"          // for ScopedMap<>::const_iterator
     51#include "Common/ScopedMap.h"          // for ScopedMap
    5952#include "Common/SemanticError.h"      // for SemanticError
    6053#include "Common/UniqueName.h"         // for UniqueName
    6154#include "Common/utility.h"            // for operator+, cloneAll, deleteAll
    62 #include "Concurrency/Keywords.h"      // for applyKeywords, implementMutexF...
     55#include "Concurrency/Keywords.h"      // for applyKeywords
    6356#include "FixFunction.h"               // for FixFunction
    6457#include "Indexer.h"                   // for Indexer
    65 #include "InitTweak/InitTweak.h"       // for isCtorDtor, isCtorDtorAssign
    66 #include "Parser/LinkageSpec.h"        // for C, Cforall
    67 #include "ResolvExpr/typeops.h"        // for extractResultType, typesCompat...
    68 #include "SynTree/Attribute.h"         // for Attribute
     58#include "InitTweak/InitTweak.h"       // for isCtorDtorAssign
     59#include "Parser/LinkageSpec.h"        // for C
     60#include "ResolvExpr/typeops.h"        // for typesCompatible
     61#include "SymTab/AddVisit.h"           // for addVisit
     62#include "SymTab/Autogen.h"            // for SizeType
     63#include "SynTree/Attribute.h"         // for noAttributes, Attribute
    6964#include "SynTree/Constant.h"          // for Constant
    70 #include "SynTree/Declaration.h"       // for EnumDecl, StructDecl, UnionDecl
    71 #include "SynTree/Expression.h"        // for TypeExpr, CompoundLiteralExpr
    72 #include "SynTree/Initializer.h"       // for ListInit, Initializer, noDesig...
    73 #include "SynTree/Mutator.h"           // for mutateAll, Mutator
    74 #include "SynTree/Statement.h"         // for CompoundStmt, DeclStmt, Return...
    75 #include "SynTree/Type.h"              // for Type, TypeInstType, TraitInstType
    76 #include "SynTree/TypeSubstitution.h"  // for TypeSubstitution, applySubstit...
    77 #include "SynTree/Visitor.h"           // for acceptAll, Visitor
     65#include "SynTree/Declaration.h"       // for ObjectDecl, DeclarationWithType
     66#include "SynTree/Expression.h"        // for CompoundLiteralExpr, Expressio...
     67#include "SynTree/Initializer.h"       // for ListInit, Initializer
     68#include "SynTree/Label.h"             // for operator==, Label
     69#include "SynTree/Mutator.h"           // for Mutator
     70#include "SynTree/Type.h"              // for Type, TypeInstType, EnumInstType
     71#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     72#include "SynTree/Visitor.h"           // for Visitor
     73
     74class CompoundStmt;
     75class ReturnStmt;
     76class SwitchStmt;
     77
    7878
    7979#define debugPrint( x ) if ( doDebug ) { std::cout << x; }
  • src/SynTree/AddStmtVisitor.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "AddStmtVisitor.h"
    17 #include "Statement.h"
    18 #include "Declaration.h"
    19 #include "Expression.h"
    20 #include "Common/utility.h"
     17
     18#include "Common/SemanticError.h"  // for SemanticError
     19#include "Declaration.h"           // for Declaration
     20#include "Expression.h"            // for Expression
     21#include "Statement.h"             // for CompoundStmt, ForStmt, IfStmt, Sta...
     22#include "SynTree/Label.h"         // for Label, noLabels
    2123
    2224void AddStmtVisitor::visitStatementList( std::list< Statement* > &statements ) {
  • src/SynTree/AddStmtVisitor.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
     18#include <list>               // for list
    1919
    20 #include "SynTree/SynTree.h"
    21 #include "SynTree/Visitor.h"
     20#include "SynTree/SynTree.h"  // for Visitor Nodes
     21#include "SynTree/Visitor.h"  // for Visitor
    2222
    2323class AddStmtVisitor : public Visitor {
  • src/SynTree/AddressExpr.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Expression.h"
    17 #include "Type.h"
    18 #include "Common/utility.h"
     16#include <ostream>           // for ostream, operator<<, basic_ostream, endl
     17#include <string>            // for operator<<, string
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Expression.h"      // for AddressExpr, Expression
     21#include "Type.h"            // for PointerType, Type, Type::Qualifiers
    1922
    2023// Address expressions are typed based on the following inference rules:
  • src/SynTree/AggregateDecl.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Attribute.h"
    18 #include "Type.h"
    19 #include "Common/utility.h"
     16#include <list>                  // for list
     17#include <ostream>               // for operator<<, basic_ostream, ostream
     18#include <string>                // for operator<<, string, char_traits
     19
     20#include "Attribute.h"           // for Attribute
     21#include "Common/utility.h"      // for printAll, cloneAll, deleteAll
     22#include "Declaration.h"         // for AggregateDecl, TypeDecl, Declaration
     23#include "Parser/LinkageSpec.h"  // for Spec, linkageName, Cforall
     24#include "Type.h"                // for Type, Type::StorageClasses
    2025
    2126
  • src/SynTree/ApplicationExpr.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
     16#include <cassert>               // for safe_dynamic_cast, assert
     17#include <list>                  // for list
     18#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
     19#include <memory>                // for unique_ptr
     20#include <ostream>               // for operator<<, ostream, basic_ostream
     21#include <string>                // for operator<<, string, char_traits
     22#include <utility>               // for pair
    1723
    18 #include "Expression.h"
    19 #include "Declaration.h"
    20 #include "Type.h"
    21 #include "TypeSubstitution.h"
    22 #include "Common/utility.h"
    23 #include "ResolvExpr/typeops.h"
     24#include "Common/utility.h"      // for maybeClone, cloneAll, deleteAll, pri...
     25#include "Declaration.h"         // for Declaration
     26#include "Expression.h"          // for ParamEntry, ApplicationExpr, Expression
     27#include "ResolvExpr/typeops.h"  // for extractResultType
     28#include "Type.h"                // for Type, PointerType, FunctionType
    2429
    2530ParamEntry::ParamEntry( const ParamEntry &other ) :
  • src/SynTree/ArrayType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
    17 #include "Expression.h"
    18 #include "Common/utility.h"
     16#include <list>              // for list
     17#include <ostream>           // for operator<<, ostream
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Expression.h"      // for Expression
     21#include "Type.h"            // for ArrayType, Type, Type::Qualifiers
     22
     23class Attribute;
    1924
    2025
  • src/SynTree/AttrType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
    17 #include "Expression.h"
    18 #include "Common/utility.h"
     16#include <list>              // for list
     17#include <ostream>           // for operator<<, ostream, basic_ostream
     18#include <string>            // for char_traits, operator<<, string
     19
     20#include "Common/utility.h"  // for maybeClone
     21#include "Expression.h"      // for Expression
     22#include "Type.h"            // for AttrType, Type, Type::Qualifiers
     23
     24class Attribute;
    1925
    2026
  • src/SynTree/Attribute.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
     16#include <ostream>           // for operator<<, ostream, basic_ostream, endl
    1717
    18 #include "Common/utility.h"
    1918#include "Attribute.h"
    20 #include "Expression.h"
     19#include "Common/utility.h"  // for cloneAll, deleteAll, printAll
     20#include "Expression.h"      // for Expression
    2121
    2222Attribute::Attribute( const Attribute &other ) : name( other.name ) {
  • src/SynTree/Attribute.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree.h"
     18#include <iosfwd>  // for ostream
     19#include <list>    // for list
     20#include <string>  // for string, operator==
     21
     22class Expression;
    1923
    2024// GCC attribute
  • src/SynTree/BaseSyntaxNode.h

    rfc56cdbf r8135d4c  
    99// Author           : Thierry Delisle
    1010// Created On       : Tue Feb 14 07:44:20 2017
    11 // Last Modified By :
    12 // Last Modified On :
    13 // Update Count     :
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 13:44:00
     13// Update Count     : 1
    1414//
    1515
    1616#pragma once
    1717
    18 #include "Common/utility.h"
    19 #include "Visitor.h"
     18#include "Common/CodeLocation.h"
     19class Visitor;
    2020
    2121class BaseSyntaxNode {
  • src/SynTree/BasicType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
    17 #include "Type.h"
     16#include <cassert>  // for assert
     17#include <list>     // for list
     18#include <ostream>  // for operator<<, ostream
     19
     20#include "Type.h"   // for BasicType, Type, BasicType::Kind, BasicType::Kind...
     21
     22class Attribute;
    1823
    1924BasicType::BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), kind( bt ) {}
  • src/SynTree/CommaExpr.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Expression.h"
    17 #include "Type.h"
    18 #include "Common/utility.h"
     16#include <ostream>           // for ostream, endl, operator<<, basic_ostream
     17#include <string>            // for operator<<, string
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Expression.h"      // for CommaExpr, Expression
     21#include "Type.h"            // for Type
    1922
    2023CommaExpr::CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname )
  • src/SynTree/CompoundStmt.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Statement.h"
    17 #include "Common/utility.h"
    18 #include <algorithm>
    19 #include <functional>
    20 #include "Expression.h"
    21 #include "Declaration.h"
    22 #include "SynTree/VarExprReplacer.h"
     16#include <cassert>                    // for assert, safe_dynamic_cast
     17#include <list>                       // for list, _List_const_iterator, lis...
     18#include <ostream>                    // for operator<<, ostream, basic_ostream
     19#include <string>                     // for operator==, string
     20
     21#include "Common/utility.h"           // for cloneAll, deleteAll, printAll
     22#include "Declaration.h"              // for DeclarationWithType, Declaration
     23#include "Statement.h"                // for CompoundStmt, Statement, DeclStmt
     24#include "SynTree/Label.h"            // for Label
     25#include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
    2326
    2427using std::string;
  • src/SynTree/Constant.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <iostream>
    17 #include <list>
    18 #include <string>
     16#include <cassert>   // for safe_dynamic_cast, assertf
     17#include <iostream>  // for operator<<, ostream, basic_ostream
     18#include <string>    // for to_string, string, char_traits, operator<<
    1919
    2020#include "Constant.h"
    21 #include "Type.h"
     21#include "Type.h"    // for BasicType, Type, Type::Qualifiers, PointerType
    2222
    2323Constant::Constant( Type * type, std::string rep, unsigned long long val ) : type( type ), rep( rep ), val( val ) {}
  • src/SynTree/Constant.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree.h"
    19 #include "Visitor.h"
    20 #include "Mutator.h"
     18#include <iosfwd>     // for ostream
     19#include <string>     // for string
     20
     21#include "Mutator.h"  // for Mutator
     22#include "Visitor.h"  // for Visitor
     23
     24class Type;
    2125
    2226class Constant {
  • src/SynTree/DeclStmt.cc

    rfc56cdbf r8135d4c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // DeclStmt.cc -- 
     7// DeclStmt.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1414//
    1515
    16 #include "Statement.h"
    17 #include "Declaration.h"
    18 #include "Common/utility.h"
     16#include <cassert>           // for assert
     17#include <list>              // for list
     18#include <ostream>           // for operator<<, ostream
     19
     20#include "Common/utility.h"  // for maybeClone
     21#include "Declaration.h"     // for Declaration
     22#include "Statement.h"       // for DeclStmt, Statement
     23#include "SynTree/Label.h"   // for Label
    1924
    2025DeclStmt::DeclStmt( std::list<Label> labels, Declaration *decl ) : Statement( labels ), decl( decl ) {
  • src/SynTree/Declaration.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <string>
    17 #include <map>
     16#include <map>                       // for _Rb_tree_const_iterator, map<>::...
     17#include <ostream>                   // for ostream, operator<<, basic_ostre...
     18#include <string>                    // for string
     19#include <utility>                   // for pair
     20
     21#include "Common/utility.h"          // for maybeClone
    1822#include "Declaration.h"
    19 #include "Expression.h"
    20 #include "Initializer.h"
    21 #include "Type.h"
    22 #include "Attribute.h"
    23 #include "Common/utility.h"
     23#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     24#include "SynTree/Statement.h"       // for AsmStmt
     25#include "SynTree/SynTree.h"         // for UniqueId
     26#include "Type.h"                    // for Type, Type::StorageClasses
    2427
    2528static UniqueId lastUniqueId = 0;
  • src/SynTree/Declaration.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <string>
    19 
    20 #include "BaseSyntaxNode.h"
    21 #include "Mutator.h"
    22 #include "Visitor.h"
    23 #include "SynTree.h"
    24 #include "Parser/LinkageSpec.h"
    25 #include "Parser/ParseNode.h"
     18#include <cassert>               // for assertf
     19#include <iosfwd>                // for ostream
     20#include <list>                  // for list
     21#include <string>                // for string, operator+, allocator, to_string
     22
     23#include "BaseSyntaxNode.h"      // for BaseSyntaxNode
     24#include "Mutator.h"             // for Mutator
     25#include "Parser/LinkageSpec.h"  // for Spec, Cforall
     26#include "Parser/ParseNode.h"    // for DeclarationNode, DeclarationNode::Ag...
     27#include "SynTree.h"             // for UniqueId
     28#include "SynTree/Type.h"        // for Type, Type::StorageClasses, Type::Fu...
     29#include "Visitor.h"             // for Visitor
     30
     31class AsmStmt;
     32class Attribute;
     33class CompoundStmt;
     34class ConstantExpr;
     35class Expression;
     36class Initializer;
     37class TypeDecl;
    2638
    2739class Declaration : public BaseSyntaxNode {
  • src/SynTree/DeclarationWithType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Type.h"
    18 #include "Attribute.h"
    19 #include "Common/utility.h"
     16#include <list>                  // for list
     17#include <string>                // for string
     18
     19#include "Attribute.h"           // for Attribute
     20#include "Common/utility.h"      // for cloneAll, deleteAll, maybeClone
     21#include "Declaration.h"         // for DeclarationWithType, Declaration
     22#include "Parser/LinkageSpec.h"  // for Spec
     23#include "SynTree/Expression.h"  // for ConstantExpr
     24#include "Type.h"                // for Type, Type::FuncSpecifiers, Type::St...
    2025
    2126DeclarationWithType::DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs )
  • src/SynTree/Expression.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <iostream>
    17 #include <cassert>
    18 #include <list>
    19 #include <algorithm>
    20 
    21 #include <iterator>
    22 
    23 #include "Declaration.h"
    24 #include "Expression.h"
    25 #include "Initializer.h"
    26 #include "Statement.h"
    27 #include "Type.h"
    28 #include "TypeSubstitution.h"
    29 #include "VarExprReplacer.h"
    30 
    31 #include "Common/utility.h"
    32 #include "Common/PassVisitor.h"
    33 
    34 #include "InitTweak/InitTweak.h"
     16#include "SynTree/Expression.h"
     17
     18#include <cassert>                   // for assert, assertf
     19#include <iostream>                  // for ostream, operator<<, basic_ostream
     20#include <list>                      // for list, _List_iterator, list<>::co...
     21
     22#include "Common/utility.h"          // for maybeClone, cloneAll, deleteAll
     23#include "Declaration.h"             // for ObjectDecl, DeclarationWithType
     24#include "Expression.h"              // for Expression, ImplicitCopyCtorExpr
     25#include "InitTweak/InitTweak.h"     // for getCallArg, getPointerBase
     26#include "Initializer.h"             // for Designation, Initializer
     27#include "Statement.h"               // for CompoundStmt, ExprStmt, Statement
     28#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     29#include "SynTree/Constant.h"        // for Constant
     30#include "Type.h"                    // for Type, BasicType, Type::Qualifiers
     31#include "TypeSubstitution.h"        // for TypeSubstitution
    3532
    3633#include "GenPoly/Lvalue.h"
  • src/SynTree/Expression.h

    rfc56cdbf r8135d4c  
    1313// Update Count     : 44
    1414//
    15 
    1615#pragma once
    1716
    18 #include <map>
    19 #include <memory>
    20 
    21 #include "BaseSyntaxNode.h"
    22 #include "Constant.h"
    23 #include "Mutator.h"
    24 #include "SynTree.h"
    25 #include "Visitor.h"
    26 #include "Common/UniqueName.h"
     17#include <iosfwd>                 // for ostream
     18#include <list>                   // for list, list<>::iterator
     19#include <map>                    // for map, map<>::value_compare
     20#include <memory>                 // for allocator, unique_ptr
     21#include <string>                 // for string
     22
     23#include "BaseSyntaxNode.h"       // for BaseSyntaxNode
     24#include "Constant.h"             // for Constant
     25#include "Initializer.h"          // for Designation (ptr only), Initializer
     26#include "Mutator.h"              // for Mutator
     27#include "SynTree.h"              // for UniqueId
     28#include "Visitor.h"              // for Visitor
     29
    2730
    2831/// Expression is the root type for all expressions
     
    5760
    5861struct ParamEntry;
     62
    5963typedef std::map< UniqueId, ParamEntry > InferredParams;
    6064
  • src/SynTree/FunctionDecl.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <cassert>
     16#include <cassert>               // for assert
     17#include <list>                  // for list
     18#include <ostream>               // for operator<<, ostream, basic_ostream
     19#include <string>                // for operator<<, string, char_traits, ope...
    1720
    18 #include "Declaration.h"
    19 #include "Statement.h"
    20 #include "Type.h"
    21 #include "Attribute.h"
    22 #include "Common/utility.h"
    23 #include "InitTweak/InitTweak.h"
    24 #include "CodeGen/FixMain.h"
     21#include "Attribute.h"           // for Attribute
     22#include "CodeGen/FixMain.h"     // for FixMain
     23#include "Common/utility.h"      // for maybeClone, printAll
     24#include "Declaration.h"         // for FunctionDecl, FunctionDecl::Parent
     25#include "Parser/LinkageSpec.h"  // for Spec, linkageName, Cforall
     26#include "Statement.h"           // for CompoundStmt
     27#include "Type.h"                // for Type, FunctionType, Type::FuncSpecif...
    2528
    2629extern bool translation_unit_nomain;
  • src/SynTree/FunctionType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <algorithm>
     16#include <list>              // for list
     17#include <ostream>           // for operator<<, basic_ostream, ostream, endl
     18#include <string>            // for operator<<, char_traits, string
    1719
    18 #include "Type.h"
    19 #include "Declaration.h"
    20 #include "Common/utility.h"
    21 #include "Tuples/Tuples.h"
     20#include "Common/utility.h"  // for cloneAll, deleteAll, printAll
     21#include "Declaration.h"     // for DeclarationWithType
     22#include "Tuples/Tuples.h"   // for isTtype
     23#include "Type.h"            // for FunctionType, Type, Type::Qualifiers
     24
     25class Attribute;
    2226
    2327FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), isVarArgs( isVarArgs ) {
  • src/SynTree/Initializer.cc

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug  3 11:33:00 2016
    13 // Update Count     : 29
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Aug 21 09:53:15 2017
     13// Update Count     : 30
    1414//
    1515
    1616#include "Initializer.h"
    17 #include "Expression.h"
    18 #include "Statement.h"
    19 #include "Common/utility.h"
     17
     18#include <cassert>                   // for assertf
     19#include <ostream>                   // for ostream, operator<<, basic_ostream
     20#include <string>                    // for operator<<, string, char_traits
     21
     22#include "Common/utility.h"          // for maybeClone, cloneAll, deleteAll
     23#include "Expression.h"              // for Expression
     24#include "Statement.h"               // for Statement
     25#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
    2026
    2127Designation::Designation( const std::list< Expression * > & designators ) : designators( designators ) {}
     
    7480                        }
    7581                }
    76                 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%lu) and designations (%lu)", initializers.size(), designations.size() );
     82                assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%zd) and designations (%zd)", initializers.size(), designations.size() );
    7783}
    7884
  • src/SynTree/Initializer.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <cassert>
     18#include <iosfwd>            // for ostream
     19#include <list>              // for list, list<>::const_iterator, list<>::it...
    1920
    20 #include "BaseSyntaxNode.h"
    21 #include "Mutator.h"
    22 #include "SynTree.h"
    23 #include "Type.h"
    24 #include "Visitor.h"
     21#include "BaseSyntaxNode.h"  // for BaseSyntaxNode
     22#include "Mutator.h"         // for Mutator
     23#include "Visitor.h"         // for Visitor
     24
     25class Expression;
     26class Statement;
    2527
    2628// Designation: list of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an object being initialized.
  • src/SynTree/Mutator.cc

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 24 16:32:00 2017
    13 // Update Count     : 25
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Aug 17 15:39:37 2017
     13// Update Count     : 27
    1414//
    1515
    16 #include <cassert>
     16#include <cassert>             // for assert
     17#include <list>                // for list
     18
     19#include "Declaration.h"       // for ObjectDecl, Declaration, DeclarationWi...
     20#include "Expression.h"        // for Expression, ConstantExpr, ConditionalExpr
     21#include "Initializer.h"       // for ConstructorInit, Initializer, Designation
    1722#include "Mutator.h"
    18 #include "Initializer.h"
    19 #include "Statement.h"
    20 #include "Type.h"
    21 #include "Declaration.h"
    22 #include "Expression.h"
    23 #include "Constant.h"
    24 #include "Common/utility.h"
    25 #include "TypeSubstitution.h"
     23#include "Statement.h"         // for Statement, CatchStmt, AsmStmt, ForStmt
     24#include "Type.h"              // for Type, Type::ForallList, AttrType, Arra...
     25#include "TypeSubstitution.h"  // for TypeSubstitution
     26
     27class Constant;
     28class Subrange;
    2629
    2730Mutator::Mutator() {}
     
    111114
    112115Statement *Mutator::mutate( IfStmt *ifStmt ) {
     116        mutateAll( ifStmt->get_initialization(), *this );
    113117        ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) );
    114118        ifStmt->set_thenPart( maybeMutate( ifStmt->get_thenPart(), *this ) );
  • src/SynTree/Mutator.h

    rfc56cdbf r8135d4c  
    1313// Update Count     : 16
    1414//
    15 #include <cassert>
     15#pragma once
    1616
    17 #include "SynTree.h"
    18 #include "Common/SemanticError.h"
     17#include <cassert>                 // for assert
    1918
    20 #pragma once
     19#include "Common/SemanticError.h"  // for SemanticError
     20#include "SynTree/SynTree.h"       // for AST nodes
    2121
    2222class Mutator {
  • src/SynTree/NamedTypeDecl.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Type.h"
    18 #include "Common/utility.h"
     16#include <list>                  // for list
     17#include <ostream>               // for operator<<, ostream, basic_ostream
     18#include <string>                // for operator<<, string, char_traits, ope...
     19
     20#include "Common/utility.h"      // for printAll, cloneAll, deleteAll, maybe...
     21#include "Declaration.h"         // for NamedTypeDecl, DeclarationWithType
     22#include "Parser/LinkageSpec.h"  // for Spec, Cforall, linkageName
     23#include "Type.h"                // for Type, Type::StorageClasses
    1924
    2025NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base )
  • src/SynTree/ObjectDecl.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Type.h"
    18 #include "Initializer.h"
    19 #include "Expression.h"
    20 #include "Attribute.h"
    21 #include "Common/utility.h"
    22 #include "Statement.h"
     16#include <list>                  // for list
     17#include <ostream>               // for operator<<, ostream, basic_ostream
     18#include <string>                // for operator<<, string, char_traits, ope...
     19
     20#include "Attribute.h"           // for Attribute
     21#include "Common/utility.h"      // for maybeClone, printAll
     22#include "Declaration.h"         // for ObjectDecl, ObjectDecl::Parent
     23#include "Expression.h"          // for Expression
     24#include "Initializer.h"         // for Initializer
     25#include "Parser/LinkageSpec.h"  // for Spec, linkageName, Cforall
     26#include "Type.h"                // for Type, Type::StorageClasses, Type::Fu...
    2327
    2428ObjectDecl::ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, Type::FuncSpecifiers fs )
  • src/SynTree/PointerType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
    17 #include "Expression.h"
    18 #include "Common/utility.h"
     16#include <list>              // for list
     17#include <ostream>           // for operator<<, ostream
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Expression.h"      // for Expression
     21#include "Type.h"            // for PointerType, Type, Type::Qualifiers
     22
     23class Attribute;
    1924
    2025PointerType::PointerType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
  • src/SynTree/ReferenceToType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <string>
    17 #include <cassert>
     16#include <stddef.h>          // for NULL
     17#include <cassert>           // for assert
     18#include <list>              // for list, _List_const_iterator, list<>::cons...
     19#include <ostream>           // for operator<<, basic_ostream, ostream, endl
     20#include <string>            // for string, operator<<, char_traits, operator==
    1821
    19 #include "Type.h"
    20 #include "Declaration.h"
    21 #include "Expression.h"
    22 #include "TypeSubstitution.h"
    23 #include "Common/utility.h"
     22#include "Common/utility.h"  // for printAll, cloneAll, deleteAll
     23#include "Declaration.h"     // for StructDecl, UnionDecl, EnumDecl, Declara...
     24#include "Expression.h"      // for Expression
     25#include "Type.h"            // for TypeInstType, StructInstType, UnionInstType
     26
     27class Attribute;
    2428
    2529ReferenceToType::ReferenceToType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), name( name ), hoistType( false ) {
  • src/SynTree/Statement.cc

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 10:37:00 2017
    13 // Update Count     : 64
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Aug 17 16:17:20 2017
     13// Update Count     : 67
    1414//
    1515
    16 #include <functional>
    17 #include <algorithm>
    18 #include <iostream>
    19 #include <list>
    20 #include <cassert>
    21 
    22 #include "Statement.h"
    23 #include "Expression.h"
    24 #include "Declaration.h"
    25 #include "Common/SemanticError.h"
     16#include "SynTree/Statement.h"
     17
     18#include <stddef.h>                // for NULL
     19#include <cassert>                 // for assert, assertf
     20#include <iostream>                // for operator<<, basic_ostream, endl
     21#include <list>                    // for list, list<>::const_iterator, _Lis...
     22#include <string>                  // for operator<<, string, char_traits
     23
     24#include "Common/SemanticError.h"  // for SemanticError
     25#include "Common/utility.h"        // for maybeClone, cloneAll, deleteAll
     26#include "Declaration.h"           // for Declaration
     27#include "Expression.h"            // for Expression, ConstantExpr
     28#include "Statement.h"             // for Statement, ForStmt, AsmStmt, Catch...
     29#include "SynTree/Label.h"         // for Label, operator<<
    2630
    2731using std::string;
    2832using std::endl;
    2933
    30 Statement::Statement( std::list<Label> _labels ) : labels( _labels ) {}
     34Statement::Statement( std::list<Label> labels ) : labels( labels ) {}
    3135
    3236void Statement::print( __attribute__((unused)) std::ostream &, __attribute__((unused)) int indent ) const {}
     
    3438Statement::~Statement() {}
    3539
    36 ExprStmt::ExprStmt( std::list<Label> _labels, Expression *_expr ) : Statement( _labels ), expr( _expr ) {}
     40ExprStmt::ExprStmt( std::list<Label> labels, Expression *expr ) : Statement( labels ), expr( expr ) {}
    3741
    3842ExprStmt::ExprStmt( const ExprStmt &other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     
    8488const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    8589
    86 BranchStmt::BranchStmt( std::list<Label> labels, Label _target, Type _type ) throw ( SemanticError ) :
    87         Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) {
     90BranchStmt::BranchStmt( std::list<Label> labels, Label target, Type type ) throw ( SemanticError ) :
     91        Statement( labels ), originalTarget( target ), target( target ), computedTarget( NULL ), type( type ) {
    8892        //actually this is a syntactic error signaled by the parser
    8993        if ( type == BranchStmt::Goto && target.empty() )
     
    9195}
    9296
    93 BranchStmt::BranchStmt( std::list<Label> labels, Expression *_computedTarget, Type _type ) throw ( SemanticError ) :
    94         Statement( labels ), computedTarget( _computedTarget ), type( _type ) {
     97BranchStmt::BranchStmt( std::list<Label> labels, Expression *computedTarget, Type type ) throw ( SemanticError ) :
     98        Statement( labels ), computedTarget( computedTarget ), type( type ) {
    9599        if ( type != BranchStmt::Goto || computedTarget == 0 )
    96100                throw SemanticError("Computed target not valid in branch statement");
     
    101105}
    102106
    103 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr ) : Statement( labels ), expr( _expr ) {}
     107ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *expr ) : Statement( labels ), expr( expr ) {}
    104108
    105109ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     
    118122}
    119123
    120 IfStmt::IfStmt( std::list<Label> _labels, Expression *_condition, Statement *_thenPart, Statement *_elsePart ):
    121         Statement( _labels ), condition( _condition ), thenPart( _thenPart ), elsePart( _elsePart ) {}
     124IfStmt::IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart, std::list<Statement *> initialization ):
     125        Statement( labels ), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {}
    122126
    123127IfStmt::IfStmt( const IfStmt & other ) :
    124         Statement( other ), condition( maybeClone( other.condition ) ), thenPart( maybeClone( other.thenPart ) ), elsePart( maybeClone( other.elsePart ) ) {}
     128        Statement( other ), condition( maybeClone( other.condition ) ), thenPart( maybeClone( other.thenPart ) ), elsePart( maybeClone( other.elsePart ) ) {
     129        cloneAll( other.initialization, initialization );
     130}
    125131
    126132IfStmt::~IfStmt() {
     133        deleteAll( initialization );
    127134        delete condition;
    128135        delete thenPart;
     
    135142        condition->print( os, indent + 4 );
    136143
     144        if ( !initialization.empty() ) {
     145                os << string( indent + 2, ' ' ) << "initialization: \n";
     146                for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
     147                        os << string( indent + 4, ' ' );
     148                        (*it)->print( os, indent + 4 );
     149                }
     150                os << endl;
     151        }
     152
    137153        os << string( indent+2, ' ' ) << "... then: " << endl;
    138154
     
    147163}
    148164
    149 SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_statements ):
    150         Statement( _labels ), condition( _condition ), statements( _statements ) {
     165SwitchStmt::SwitchStmt( std::list<Label> labels, Expression * condition, std::list<Statement *> &statements ):
     166        Statement( labels ), condition( condition ), statements( statements ) {
    151167}
    152168
     
    175191}
    176192
    177 CaseStmt::CaseStmt( std::list<Label> _labels, Expression *_condition, std::list<Statement *> &_statements, bool deflt ) throw ( SemanticError ) :
    178         Statement( _labels ), condition( _condition ), stmts( _statements ), _isDefault( deflt ) {
     193CaseStmt::CaseStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
     194        Statement( labels ), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    179195        if ( isDefault() && condition != 0 )
    180196                throw SemanticError("default with conditions");
     
    212228}
    213229
    214 WhileStmt::WhileStmt( std::list<Label> labels, Expression *condition_, Statement *body_, bool isDoWhile_ ):
    215         Statement( labels ), condition( condition_), body( body_), isDoWhile( isDoWhile_) {
     230WhileStmt::WhileStmt( std::list<Label> labels, Expression *condition, Statement *body, bool isDoWhile ):
     231        Statement( labels ), condition( condition), body( body), isDoWhile( isDoWhile) {
    216232}
    217233
     
    234250}
    235251
    236 ForStmt::ForStmt( std::list<Label> labels, std::list<Statement *> initialization_, Expression *condition_, Expression *increment_, Statement *body_ ):
    237         Statement( labels ), initialization( initialization_ ), condition( condition_ ), increment( increment_ ), body( body_ ) {
     252ForStmt::ForStmt( std::list<Label> labels, std::list<Statement *> initialization, Expression *condition, Expression *increment, Statement *body ):
     253        Statement( labels ), initialization( initialization ), condition( condition ), increment( increment ), body( body ) {
    238254}
    239255
     
    313329}
    314330
    315 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &_handlers, FinallyStmt *_finallyBlock ) :
    316         Statement( labels ), block( tryBlock ),  handlers( _handlers ), finallyBlock( _finallyBlock ) {
     331TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock ) :
     332        Statement( labels ), block( tryBlock ),  handlers( handlers ), finallyBlock( finallyBlock ) {
    317333}
    318334
     
    329345void TryStmt::print( std::ostream &os, int indent ) const {
    330346        os << "Try Statement" << endl;
    331         os << string( indent + 2, ' ' ) << "with block: " << endl;
     347        os << string( indent + 2, ' ' ) << "with block:" << endl;
     348        os << string( indent + 4, ' ' );
    332349        block->print( os, indent + 4 );
    333350
    334351        // handlers
    335         os << string( indent + 2, ' ' ) << "and handlers: " << endl;
    336         for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)
     352        os << string( indent + 2, ' ' ) << "and handlers:" << endl;
     353        for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) {
     354                os << string( indent + 4, ' ' );
    337355                (*i )->print( os, indent + 4 );
     356        }
    338357
    339358        // finally block
    340359        if ( finallyBlock != 0 ) {
    341                 os << string( indent + 2, ' ' ) << "Finally block: " << endl;
     360                os << string( indent + 2, ' ' ) << "and finally:" << endl;
    342361                finallyBlock->print( os, indent + 4 );
    343362        } // if
    344363}
    345364
    346 CatchStmt::CatchStmt( std::list<Label> labels, Kind _kind, Declaration *_decl, Expression *_cond, Statement *_body ) :
    347         Statement( labels ), kind ( _kind ), decl ( _decl ), cond ( _cond ), body( _body ) {
     365CatchStmt::CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, Expression *cond, Statement *body ) :
     366        Statement( labels ), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) {
    348367}
    349368
     
    360379        os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
    361380
    362         os << string( indent, ' ' ) << "... catching" << endl;
     381        os << string( indent + 2, ' ' ) << "... catching: ";
    363382        if ( decl ) {
    364383                decl->printShort( os, indent + 4 );
     
    367386        else
    368387                os << string( indent + 4 , ' ' ) << ">>> Error:  this catch clause must have a declaration <<<" << endl;
    369 }
    370 
    371 
    372 FinallyStmt::FinallyStmt( std::list<Label> labels, CompoundStmt *_block ) : Statement( labels ), block( _block ) {
     388
     389        if ( cond ) {
     390                os << string( indent + 2, ' ' ) << "with conditional:" << endl;
     391                os << string( indent + 4, ' ' );
     392                cond->print( os, indent + 4 );
     393        }
     394        else
     395                os << string( indent + 2, ' ' ) << "with no conditional" << endl;
     396
     397        os << string( indent + 2, ' ' ) << "with block:" << endl;
     398        os << string( indent + 4, ' ' );
     399        body->print( os, indent + 4 );
     400}
     401
     402
     403FinallyStmt::FinallyStmt( std::list<Label> labels, CompoundStmt *block ) : Statement( labels ), block( block ) {
    373404        assert( labels.empty() ); // finally statement cannot be labeled
    374405}
     
    383414void FinallyStmt::print( std::ostream &os, int indent ) const {
    384415        os << "Finally Statement" << endl;
    385         os << string( indent + 2, ' ' ) << "with block: " << endl;
     416        os << string( indent + 2, ' ' ) << "with block:" << endl;
     417        os << string( indent + 4, ' ' );
    386418        block->print( os, indent + 4 );
    387419}
  • src/SynTree/Statement.h

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug  3 14:08:00 2017
    13 // Update Count     : 69
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Aug 17 15:37:53 2017
     13// Update Count     : 72
    1414//
    1515
    1616#pragma once
    1717
    18 #include "BaseSyntaxNode.h"
    19 #include "Label.h"
    20 #include "Mutator.h"
    21 #include "SynTree.h"
    22 #include "Type.h"
    23 #include "Visitor.h"
    24 #include "Common/SemanticError.h"
     18#include <iosfwd>                  // for ostream
     19#include <list>                    // for list
     20#include <memory>                  // for allocator
     21
     22#include "BaseSyntaxNode.h"        // for BaseSyntaxNode
     23#include "Common/SemanticError.h"  // for SemanticError
     24#include "Label.h"                 // for Label
     25#include "Mutator.h"               // for Mutator
     26#include "Visitor.h"               // for Visitor
     27
     28class CatchStmt;
     29class ConstantExpr;
     30class Declaration;
     31class Expression;
     32class FinallyStmt;
    2533
    2634class Statement : public BaseSyntaxNode {
     
    122130        Statement *thenPart;
    123131        Statement *elsePart;
    124 
    125         IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart );
     132        std::list<Statement *> initialization;
     133
     134        IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart,
     135                        std::list<Statement *> initialization = std::list<Statement *>() );
    126136        IfStmt( const IfStmt &other );
    127137        virtual ~IfStmt();
    128138
     139        std::list<Statement *> &get_initialization() { return initialization; }
    129140        Expression *get_condition() { return condition; }
    130141        void set_condition( Expression *newValue ) { condition = newValue; }
     
    228239
    229240        std::list<Statement *> &get_initialization() { return initialization; }
    230         void set_initialization( std::list<Statement *> newValue ) { initialization = newValue; }
    231241        Expression *get_condition() { return condition; }
    232242        void set_condition( Expression *newValue ) { condition = newValue; }
  • src/SynTree/TupleExpr.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Expression.h"
    17 #include "Common/utility.h"
    18 #include "Type.h"
    19 #include "Declaration.h"
    20 #include "Tuples/Tuples.h"
    21 #include "VarExprReplacer.h"
     16#include <cassert>              // for assert, safe_dynamic_cast, assertf
     17#include <iterator>             // for next
     18#include <list>                 // for list, _List_iterator
     19#include <ostream>              // for ostream, operator<<, basic_ostream, endl
     20#include <string>               // for operator<<, string, char_traits
     21
     22#include "Common/utility.h"     // for cloneAll, deleteAll, printAll, toString
     23#include "Declaration.h"        // for ObjectDecl
     24#include "Expression.h"         // for Expression, TupleExpr, TupleIndexExpr
     25#include "SynTree/Label.h"      // for Label, noLabels
     26#include "SynTree/Statement.h"  // for CompoundStmt, DeclStmt, ExprStmt, Sta...
     27#include "Tuples/Tuples.h"      // for makeTupleType
     28#include "Type.h"               // for TupleType, Type
    2229
    2330UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
  • src/SynTree/TupleType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Initializer.h"
    18 #include "Type.h"
    19 #include "Common/utility.h"
    20 #include "Parser/LinkageSpec.h"
     16#include <list>                  // for list
     17#include <ostream>               // for operator<<, ostream, basic_ostream
     18
     19#include "Common/utility.h"      // for cloneAll, deleteAll, printAll
     20#include "Declaration.h"         // for Declaration, ObjectDecl
     21#include "Initializer.h"         // for ListInit
     22#include "Parser/LinkageSpec.h"  // for Cforall
     23#include "Type.h"                // for TupleType, Type, Type::Qualifiers
     24
     25class Attribute;
    2126
    2227TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
  • src/SynTree/Type.cc

    rfc56cdbf r8135d4c  
    1313// Update Count     : 29
    1414//
     15#include "Type.h"
    1516
    16 #include "SynTree.h"
    17 #include "Visitor.h"
    18 #include "Type.h"
    19 #include "Declaration.h"
    20 #include "Attribute.h"
    21 #include "InitTweak/InitTweak.h"
    22 #include "Common/utility.h"
     17#include "Attribute.h"               // for Attribute
     18#include "Common/utility.h"          // for cloneAll, deleteAll, printAll
     19#include "InitTweak/InitTweak.h"     // for getPointerBase
     20#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     21#include "SynTree/Declaration.h"     // for TypeDecl
    2322
    2423using namespace std;
  • src/SynTree/Type.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "BaseSyntaxNode.h"
    19 #include "Mutator.h"
    20 #include "SynTree.h"
    21 #include "Visitor.h"
    22 #include <strings.h>                                                                    // ffs
     18#include <strings.h>         // for ffs
     19#include <cassert>           // for assert, assertf
     20#include <list>              // for list, _List_iterator
     21#include <ostream>           // for ostream, operator<<, basic_ostream
     22#include <string>            // for string
     23
     24#include "BaseSyntaxNode.h"  // for BaseSyntaxNode
     25#include "Common/utility.h"  // for operator+
     26#include "Mutator.h"         // for Mutator
     27#include "SynTree.h"         // for AST nodes
     28#include "Visitor.h"         // for Visitor
    2329
    2430class Type : public BaseSyntaxNode {
  • src/SynTree/TypeDecl.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Type.h"
    18 #include "Common/utility.h"
     16#include <ostream>           // for ostream, operator<<, basic_ostream, basi...
     17#include <string>            // for string, char_traits, operator+, operator<<
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Declaration.h"     // for TypeDecl, TypeDecl::Data, TypeDecl::Kind...
     21#include "Type.h"            // for Type, Type::StorageClasses
    1922
    2023TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Any || kind == Ttype ), kind( kind ) {
  • src/SynTree/TypeExpr.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Expression.h"
    17 #include "Type.h"
    18 #include "Common/utility.h"
     16#include <iosfwd>            // for ostream
     17
     18#include "Common/utility.h"  // for maybeClone
     19#include "Expression.h"      // for TypeExpr, Expression
     20#include "Type.h"            // for Type
    1921
    2022TypeExpr::TypeExpr( Type *type ) : type( type ) {
  • src/SynTree/TypeSubstitution.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
     16#include <ostream>  // for ostream, basic_ostream, operator<<, endl
     17
     18#include "Type.h"   // for TypeInstType, Type, StructInstType, UnionInstType
    1719#include "TypeSubstitution.h"
    1820
  • src/SynTree/TypeSubstitution.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <map>
    19 #include <set>
    20 #include <cassert>
     18#include <cassert>                 // for assert
     19#include <iosfwd>                  // for ostream
     20#include <list>                    // for list<>::iterator, _List_iterator
     21#include <map>                     // for _Rb_tree_iterator, map, map<>::val...
     22#include <set>                     // for set
     23#include <string>                  // for string, operator!=
     24#include <utility>                 // for pair
    2125
    22 #include "SynTree/Mutator.h"
    23 #include "SynTree/Declaration.h"
    24 #include "SynTree/Expression.h"
     26#include "Common/SemanticError.h"  // for SemanticError
     27#include "SynTree/Declaration.h"   // for TypeDecl, Declaration (ptr only)
     28#include "SynTree/Expression.h"    // for Expression (ptr only), NameExpr (p...
     29#include "SynTree/Mutator.h"       // for Mutator
     30#include "SynTree/Type.h"          // for Type, ArrayType (ptr only), BasicT...
    2531
    2632class TypeSubstitution : public Mutator {
  • src/SynTree/TypeofType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
    17 #include "Expression.h"
    18 #include "Common/utility.h"
     16#include <list>              // for list
     17#include <ostream>           // for operator<<, ostream
     18
     19#include "Common/utility.h"  // for maybeClone
     20#include "Expression.h"      // for Expression
     21#include "Type.h"            // for TypeofType, Type, Type::Qualifiers
     22
     23class Attribute;
    1924
    2025TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), expr( expr ) {
  • src/SynTree/VarArgsType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
     16#include <list>     // for list
     17#include <ostream>  // for operator<<, ostream
     18
     19#include "Type.h"   // for Type, VarArgsType, Type::Qualifiers
     20
     21class Attribute;
    1722
    1823VarArgsType::VarArgsType() : Type( Type::Qualifiers(), std::list< Attribute * >() ) {}
  • src/SynTree/VarExprReplacer.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Expression.h"
     16#include <iostream>       // for operator<<, basic_ostream, ostream, basic_o...
     17
     18#include "Declaration.h"  // for operator<<, DeclarationWithType
     19#include "Expression.h"   // for VariableExpr
    1820#include "VarExprReplacer.h"
    1921
  • src/SynTree/VarExprReplacer.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <map>
     18#include <map>                // for map, map<>::value_compare
    1919
    20 #include "SynTree/SynTree.h"
     20#include "SynTree/Visitor.h"  // for Visitor
     21
     22class DeclarationWithType;
     23class VariableExpr;
    2124
    2225/// Visitor that replaces the declarations that VariableExprs refer to, according to the supplied mapping
  • src/SynTree/Visitor.cc

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 24 16:30:00 2017
    13 // Update Count     : 27
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Aug 17 15:39:38 2017
     13// Update Count     : 29
    1414//
    1515
    16 #include <cassert>
     16#include <cassert>        // for assert
     17#include <list>           // for list
     18
     19#include "Constant.h"     // for Constant
     20#include "Declaration.h"  // for DeclarationWithType, ObjectDecl, Declaration
     21#include "Expression.h"   // for Expression, ConstantExpr, ImplicitCopyCtorExpr
     22#include "Initializer.h"  // for Initializer, Designation, ConstructorInit
     23#include "Statement.h"    // for Statement, CatchStmt, AsmStmt, CompoundStmt
     24#include "Type.h"         // for Type, Type::ForallList, AttrType, FunctionType
    1725#include "Visitor.h"
    18 #include "Initializer.h"
    19 #include "Statement.h"
    20 #include "Type.h"
    21 #include "Declaration.h"
    22 #include "Expression.h"
    23 #include "Constant.h"
     26
     27class Subrange;
    2428
    2529Visitor::Visitor() {}
     
    9599
    96100void Visitor::visit( IfStmt *ifStmt ) {
     101        acceptAll( ifStmt->get_initialization(), *this );
    97102        maybeAccept( ifStmt->get_condition(), *this );
    98103        maybeAccept( ifStmt->get_thenPart(), *this );
  • src/SynTree/Visitor.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "SynTree.h"
    19 #include "Common/SemanticError.h"
    20 #include "Common/CompilerError.h"
     18#include "Common/SemanticError.h"  // for SemanticError
     19#include "SynTree.h"               // for AST nodes
    2120
    2221class Visitor {
  • src/SynTree/VoidType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
     16#include <list>     // for list
     17#include <ostream>  // for operator<<, ostream
     18
     19#include "Type.h"   // for VoidType, Type, Type::Qualifiers
     20
     21class Attribute;
    1722
    1823VoidType::VoidType( const Type::Qualifiers &tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {
  • src/SynTree/ZeroOneType.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "Type.h"
     16#include <list>     // for list
     17#include <ostream>  // for operator<<, ostream
     18
     19#include "Type.h"   // for Type, Type::Qualifiers, OneType, ZeroType
     20
     21class Attribute;
    1722
    1823ZeroType::ZeroType() : Type( Type::Qualifiers(), std::list< Attribute * >() ) {}
  • src/Tuples/Explode.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "Explode.h"
    17 #include "SynTree/Mutator.h"
    18 #include "Common/PassVisitor.h"
     17#include <list>                  // for list
     18
     19#include "SynTree/Mutator.h"     // for Mutator
     20#include "Common/PassVisitor.h"  // for PassVisitor
    1921
    2022namespace Tuples {
  • src/Tuples/Explode.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include "ResolvExpr/AlternativeFinder.h"
    19 #include "ResolvExpr/Resolver.h"
     18#include <iterator>                  // for back_inserter, back_insert_iterator
    2019
    21 #include "SynTree/Expression.h"
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Type.h"
     20#include "ResolvExpr/Alternative.h"  // for Alternative, AltList
     21#include "SynTree/Expression.h"      // for Expression, UniqueExpr, AddressExpr
     22#include "SynTree/Type.h"            // for TupleType, Type
     23#include "Tuples.h"                  // for maybeImpure
    2424
    25 #include "Tuples.h"
     25namespace SymTab {
     26class Indexer;
     27}  // namespace SymTab
    2628
    2729namespace Tuples {
  • src/Tuples/TupleAssignment.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include "ResolvExpr/AlternativeFinder.h"
    17 #include "ResolvExpr/Alternative.h"
    18 #include "ResolvExpr/typeops.h"
    19 #include "SynTree/Expression.h"
    20 #include "SynTree/Initializer.h"
    21 #include "Tuples.h"
    22 #include "Explode.h"
    23 #include "Common/SemanticError.h"
     16#include <algorithm>                       // for transform
     17#include <cassert>                         // for assert
     18#include <iterator>                        // for back_insert_iterator, back...
     19#include <list>                            // for _List_const_iterator, _Lis...
     20#include <memory>                          // for unique_ptr, allocator_trai...
     21#include <string>                          // for string
     22
    2423#include "CodeGen/OperatorTable.h"
    25 #include "InitTweak/InitTweak.h"
    26 #include "InitTweak/GenInit.h"
    27 
    28 #include <functional>
    29 #include <algorithm>
    30 #include <iterator>
    31 #include <iostream>
    32 #include <cassert>
    33 #include <set>
    34 #include <unordered_set>
     24#include "Common/UniqueName.h"             // for UniqueName
     25#include "Common/utility.h"                // for zipWith
     26#include "Explode.h"                       // for explode
     27#include "InitTweak/GenInit.h"             // for genCtorInit
     28#include "InitTweak/InitTweak.h"           // for getPointerBase, isAssignment
     29#include "Parser/LinkageSpec.h"            // for Cforall
     30#include "ResolvExpr/Alternative.h"        // for AltList, Alternative
     31#include "ResolvExpr/AlternativeFinder.h"  // for AlternativeFinder, simpleC...
     32#include "ResolvExpr/Cost.h"               // for Cost
     33#include "ResolvExpr/Resolver.h"           // for resolveCtorInit
     34#include "ResolvExpr/TypeEnvironment.h"    // for TypeEnvironment
     35#include "SynTree/Declaration.h"           // for ObjectDecl
     36#include "SynTree/Expression.h"            // for Expression, CastExpr, Name...
     37#include "SynTree/Initializer.h"           // for ConstructorInit, SingleInit
     38#include "SynTree/Statement.h"             // for ExprStmt
     39#include "SynTree/Type.h"                  // for Type, Type::Qualifiers
     40#include "SynTree/TypeSubstitution.h"      // for TypeSubstitution
     41#include "SynTree/Visitor.h"               // for Visitor
    3542
    3643namespace Tuples {
  • src/Tuples/TupleExpansion.cc

    rfc56cdbf r8135d4c  
    1414//
    1515
    16 #include <iterator>
    17 #include <iostream>
    18 #include <cassert>
    19 #include "Tuples.h"
    20 #include "Common/PassVisitor.h"
    21 #include "Common/ScopedMap.h"
    22 #include "GenPoly/DeclMutator.h"
    23 #include "InitTweak/GenInit.h"
    24 #include "InitTweak/InitTweak.h"
    25 #include "ResolvExpr/typeops.h"
    26 #include "SymTab/Mangler.h"
    27 #include "SynTree/Declaration.h"
    28 #include "SynTree/Expression.h"
    29 #include "SynTree/Initializer.h"
    30 #include "SynTree/Mutator.h"
    31 #include "SynTree/Statement.h"
    32 #include "SynTree/Type.h"
     16#include <stddef.h>               // for size_t
     17#include <cassert>                // for assert
     18#include <list>                   // for list
     19
     20#include "Common/PassVisitor.h"   // for PassVisitor, WithDeclsToAdd, WithGu...
     21#include "Common/ScopedMap.h"     // for ScopedMap
     22#include "Common/utility.h"       // for CodeLocation
     23#include "GenPoly/DeclMutator.h"  // for DeclMutator
     24#include "InitTweak/InitTweak.h"  // for getFunction
     25#include "Parser/LinkageSpec.h"   // for Spec, C, Intrinsic
     26#include "SynTree/Constant.h"     // for Constant
     27#include "SynTree/Declaration.h"  // for StructDecl, DeclarationWithType
     28#include "SynTree/Expression.h"   // for UntypedMemberExpr, Expression, Uniq...
     29#include "SynTree/Label.h"        // for operator==, Label
     30#include "SynTree/Mutator.h"      // for Mutator
     31#include "SynTree/Type.h"         // for Type, Type::Qualifiers, TupleType
     32#include "SynTree/Visitor.h"      // for Visitor
     33
     34class CompoundStmt;
     35class TypeSubstitution;
    3336
    3437namespace Tuples {
  • src/Virtual/ExpandCasts.cc

    rfc56cdbf r8135d4c  
    1515
    1616#include "ExpandCasts.h"
    17 #include "Common/PassVisitor.h"
     17
     18#include <cassert>                 // for assert, assertf
     19#include <iterator>                // for back_inserter, inserter
     20#include <map>                     // for map, _Rb_tree_iterator, map<>::ite...
     21#include <string>                  // for string, allocator, operator==, ope...
     22#include <utility>                 // for pair
     23
     24#include "Common/PassVisitor.h"    // for PassVisitor
     25#include "Common/SemanticError.h"  // for SemanticError
     26#include "SynTree/Declaration.h"   // for ObjectDecl, StructDecl, FunctionDecl
     27#include "SynTree/Expression.h"    // for VirtualCastExpr, CastExpr, Address...
     28#include "SynTree/Mutator.h"       // for mutateAll
     29#include "SynTree/Type.h"          // for Type, PointerType, StructInstType
     30#include "SynTree/Visitor.h"       // for acceptAll
    1831
    1932namespace Virtual {
  • src/Virtual/ExpandCasts.h

    rfc56cdbf r8135d4c  
    1616#pragma once
    1717
    18 #include <list>
    19 #include "SynTree/SynTree.h"
     18#include <list>  // for list
     19
     20class Declaration;
    2021
    2122namespace Virtual {