Changes in / [d4b37ab:25404c7]


Ignore:
Location:
src
Files:
10 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    rd4b37ab r25404c7  
    168168                auto attr = get<Attribute>().acceptL( node->attributes );
    169169
    170                 // This field can be unset very early on (Pre-FixReturnTypes).
    171                 auto newType = (type) ? type->clone() : nullptr;
    172 
    173170                auto decl = new ObjectDecl(
    174171                        node->name,
     
    176173                        LinkageSpec::Spec( node->linkage.val ),
    177174                        bfwd,
    178                         newType,
     175                        type->clone(),
    179176                        nullptr, // prevent infinite loop
    180177                        attr,
     
    15821579
    15831580        virtual void visit( const ObjectDecl * old ) override final {
    1584                 if ( inCache( old ) ) {
    1585                         return;
    1586                 }
    15871581                auto&& type = GET_ACCEPT_1(type, Type);
    15881582                auto&& init = GET_ACCEPT_1(init, Init);
    15891583                auto&& bfwd = GET_ACCEPT_1(bitfieldWidth, Expr);
    15901584                auto&& attr = GET_ACCEPT_V(attributes, Attribute);
    1591 
     1585                if ( inCache( old ) ) {
     1586                        return;
     1587                }
    15921588                auto decl = new ast::ObjectDecl(
    15931589                        old->location,
  • src/AST/Decl.hpp

    rd4b37ab r25404c7  
    315315
    316316        EnumDecl( const CodeLocation& loc, const std::string& name,
    317                 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, Type const * base = nullptr,
     317                std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, Type * base = nullptr,
    318318                std::unordered_map< std::string, long long > enumValues = std::unordered_map< std::string, long long >() )
    319319        : AggregateDecl( loc, name, std::move(attrs), linkage ), base(base), enumValues(enumValues) {}
  • src/CodeGen/CodeGenerator.cc

    rd4b37ab r25404c7  
    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 : Wed Jun 29 14:34:00 2022
    13 // Update Count     : 542
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb  2 20:30:30 2022
     13// Update Count     : 541
    1414//
    1515#include "CodeGenerator.h"
     
    1818#include <list>                      // for _List_iterator, list, list<>::it...
    1919
    20 #include "AST/Decl.hpp"              // for DeclWithType
    2120#include "Common/UniqueName.h"       // for UniqueName
    2221#include "Common/utility.h"          // for CodeLocation, toString
     
    12391238                } // if
    12401239        }
    1241 
    1242 std::string genName( ast::DeclWithType const * decl ) {
    1243         if ( const OperatorInfo * opInfo = operatorLookup( decl->name ) ) {
    1244                 return opInfo->outputName;
    1245         } else {
    1246                 return decl->name;
    1247         }
    1248 }
    1249 
    12501240} // namespace CodeGen
    12511241
  • src/CodeGen/CodeGenerator.h

    rd4b37ab r25404c7  
    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 : Wed Jun 29 14:32:00 2022
    13 // Update Count     : 65
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb  1 09:23:21 2022
     13// Update Count     : 64
    1414//
    1515
     
    2626#include "SynTree/Visitor.h"      // for Visitor
    2727#include "SynTree/SynTree.h"      // for Visitor Nodes
    28 
    29 namespace ast {
    30         class DeclWithType;
    31 }
    3228
    3329namespace CodeGen {
     
    186182        /// returns C-compatible name of declaration
    187183        std::string genName( DeclarationWithType * decl );
    188         std::string genName( ast::DeclWithType const * decl );
    189184
    190185        inline std::ostream & operator<<( std::ostream & os, const CodeGenerator::LineEnder & endl ) {
  • src/CodeGen/GenType.cc

    rd4b37ab r25404c7  
    254254
    255255        void GenType::postvisit( EnumInstType * enumInst ) {
    256                 if ( enumInst->baseEnum && enumInst->baseEnum->base ) {
     256                if ( enumInst->baseEnum->base ) {
    257257                        typeString = genType(enumInst->baseEnum->base, "", options) + typeString;
    258258                } else {
  • src/ResolvExpr/CandidateFinder.cpp

    rd4b37ab r25404c7  
    4141#include "Common/utility.h"       // for move, copy
    4242#include "SymTab/Mangler.h"
     43#include "SymTab/Validate.h"      // for validateType
    4344#include "Tuples/Tuples.h"        // for handleTupleAssignment
    4445#include "InitTweak/InitTweak.h"  // for getPointerBase
     
    10901091                        assert( toType );
    10911092                        toType = resolveTypeof( toType, context );
     1093                        // toType = SymTab::validateType( castExpr->location, toType, symtab );
    10921094                        toType = adjustExprType( toType, tenv, symtab );
    10931095
     
    15801582                                // calculate target type
    15811583                                const ast::Type * toType = resolveTypeof( initAlt.type, context );
     1584                                // toType = SymTab::validateType( initExpr->location, toType, symtab );
    15821585                                toType = adjustExprType( toType, tenv, symtab );
    15831586                                // The call to find must occur inside this loop, otherwise polymorphic return
  • src/SymTab/FixFunction.cc

    rd4b37ab r25404c7  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 16:19:49 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Jul 12 14:28:00 2022
    13 // Update Count     : 7
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Mar  6 23:36:59 2017
     13// Update Count     : 6
    1414//
    1515
     
    122122                }
    123123
    124                 void previsit( const ast::FunctionType * ) { visit_children = false; }
    125 
    126                 const ast::Type * postvisit( const ast::FunctionType * type ) {
    127                         return new ast::PointerType( type );
    128                 }
    129 
    130124                void previsit( const ast::VoidType * ) { isVoid = true; }
    131125
     
    151145}
    152146
    153 const ast::Type * fixFunction( const ast::Type * type, bool & isVoid ) {
    154         ast::Pass< FixFunction_new > fixer;
    155         type = type->accept( fixer );
    156         isVoid |= fixer.core.isVoid;
    157         return type;
    158 }
    159 
    160147} // namespace SymTab
    161148
  • src/SymTab/FixFunction.h

    rd4b37ab r25404c7  
    1010// Created On       : Sun May 17 17:02:08 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 14:19:00 2022
    13 // Update Count     : 5
     12// Last Modified On : Sat Jul 22 09:45:55 2017
     13// Update Count     : 4
    1414//
    1515
     
    2121namespace ast {
    2222        class DeclWithType;
    23         class Type;
    2423}
    2524
     
    3231        /// Sets isVoid to true if type is void
    3332        const ast::DeclWithType * fixFunction( const ast::DeclWithType * dwt, bool & isVoid );
    34         const ast::Type * fixFunction( const ast::Type * type, bool & isVoid );
    3533} // namespace SymTab
    3634
  • src/SymTab/Validate.cc

    rd4b37ab r25404c7  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Jul 12 15:00:00 2022
    13 // Update Count     : 367
     12// Last Modified On : Tue May 17 14:36:00 2022
     13// Update Count     : 366
    1414//
    1515
     
    294294        };
    295295
    296         void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) {
     296        void validate_A( std::list< Declaration * > & translationUnit ) {
    297297                PassVisitor<HoistTypeDecls> hoistDecls;
    298298                {
     
    305305                        decayEnumsAndPointers( translationUnit ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling
    306306                }
     307        }
     308
     309        void validate_B( std::list< Declaration * > & translationUnit ) {
    307310                PassVisitor<FixQualifiedTypes> fixQual;
    308311                {
     
    314317                        EliminateTypedef::eliminateTypedef( translationUnit );
    315318                }
     319        }
     320
     321        void validate_C( std::list< Declaration * > & translationUnit ) {
    316322                PassVisitor<ValidateGenericParameters> genericParams;
    317323                PassVisitor<ResolveEnumInitializers> rei( nullptr );
     
    337343                        });
    338344                }
     345        }
     346
     347        void validate_D( std::list< Declaration * > & translationUnit ) {
    339348                {
    340349                        Stats::Heap::newPass("validate-D");
     
    353362                        });
    354363                }
     364        }
     365
     366        void validate_E( std::list< Declaration * > & translationUnit ) {
    355367                PassVisitor<CompoundLiteral> compoundliteral;
    356368                {
     
    372384                        }
    373385                }
     386        }
     387
     388        void validate_F( std::list< Declaration * > & translationUnit ) {
    374389                PassVisitor<LabelAddressFixer> labelAddrFixer;
    375390                {
     
    395410                        }
    396411                }
     412        }
     413
     414        void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) {
     415                validate_A( translationUnit );
     416                validate_B( translationUnit );
     417                validate_C( translationUnit );
     418                validate_D( translationUnit );
     419                validate_E( translationUnit );
     420                validate_F( translationUnit );
    397421        }
    398422
  • src/SymTab/Validate.h

    rd4b37ab r25404c7  
    1111// Created On       : Sun May 17 21:53:34 2015
    1212// Last Modified By : Andrew Beach
    13 // Last Modified On : Tue Jul 12 15:30:00 2022
    14 // Update Count     : 6
     13// Last Modified On : Tue May 17 14:35:00 2022
     14// Update Count     : 5
    1515//
    1616
     
    1919#include <list>  // for list
    2020
    21 class Declaration;
     21struct CodeLocation;
     22class  Declaration;
     23class  Type;
     24
     25namespace ast {
     26        class Type;
     27        class SymbolTable;
     28}
    2229
    2330namespace SymTab {
     31        class Indexer;
     32
    2433        /// Normalizes struct and function declarations
    2534        void validate( std::list< Declaration * > &translationUnit, bool doDebug = false );
     35
     36        // Sub-passes of validate.
     37        void validate_A( std::list< Declaration * > &translationUnit );
     38        void validate_B( std::list< Declaration * > &translationUnit );
     39        void validate_C( std::list< Declaration * > &translationUnit );
     40        void validate_D( std::list< Declaration * > &translationUnit );
     41        void validate_E( std::list< Declaration * > &translationUnit );
     42        void validate_F( std::list< Declaration * > &translationUnit );
    2643} // namespace SymTab
    2744
  • src/Validate/EliminateTypedef.cpp

    rd4b37ab r25404c7  
    1010// Created On       : Wed Apr 20 16:37:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 11 16:30:00 2022
    13 // Update Count     : 1
     12// Last Modified On : Mon Apr 25 14:26:00 2022
     13// Update Count     : 0
    1414//
    1515
     
    2828
    2929struct EliminateTypedefCore {
    30         // Remove typedefs from inside aggregates.
    3130        ast::StructDecl const * previsit( ast::StructDecl const * decl );
    3231        ast::UnionDecl const * previsit( ast::UnionDecl const * decl );
    33         // Remove typedefs from statement lists.
    3432        ast::CompoundStmt const * previsit( ast::CompoundStmt const * stmt );
    35         // Remove typedefs from control structure initializers.
    36         ast::IfStmt const * previsit( ast::IfStmt const * stmt );
    37         ast::ForStmt const * previsit( ast::ForStmt const * stmt );
    38         ast::WhileDoStmt const * previsit( ast::WhileDoStmt const * stmt );
    3933};
    4034
     
    6963}
    7064
    71 ast::IfStmt const * EliminateTypedefCore::previsit( ast::IfStmt const * stmt ) {
    72         return field_erase_if( stmt, &ast::IfStmt::inits, isTypedefStmt );
    73 }
    74 
    75 ast::ForStmt const * EliminateTypedefCore::previsit( ast::ForStmt const * stmt ) {
    76         return field_erase_if( stmt, &ast::ForStmt::inits, isTypedefStmt );
    77 }
    78 
    79 ast::WhileDoStmt const * EliminateTypedefCore::previsit( ast::WhileDoStmt const * stmt ) {
    80         return field_erase_if( stmt, &ast::WhileDoStmt::inits, isTypedefStmt );
    81 }
    82 
    8365} // namespace
    8466
  • src/Validate/module.mk

    rd4b37ab r25404c7  
    2626        Validate/EliminateTypedef.cpp \
    2727        Validate/EliminateTypedef.hpp \
    28         Validate/EnumAndPointerDecay.cpp \
    29         Validate/EnumAndPointerDecay.hpp \
    3028        Validate/FindSpecialDeclsNew.cpp \
    3129        Validate/FixQualifiedTypes.cpp \
    3230        Validate/FixQualifiedTypes.hpp \
    33         Validate/FixReturnTypes.cpp \
    34         Validate/FixReturnTypes.hpp \
    3531        Validate/ForallPointerDecay.cpp \
    3632        Validate/ForallPointerDecay.hpp \
     
    4137        Validate/HoistStruct.cpp \
    4238        Validate/HoistStruct.hpp \
    43         Validate/HoistTypeDecls.cpp \
    44         Validate/HoistTypeDecls.hpp \
    4539        Validate/InitializerLength.cpp \
    4640        Validate/InitializerLength.hpp \
     
    5044        Validate/LinkReferenceToTypes.hpp \
    5145        Validate/NoIdSymbolTable.hpp \
    52         Validate/ReplaceTypedef.cpp \
    53         Validate/ReplaceTypedef.hpp \
    5446        Validate/ReturnCheck.cpp \
    55         Validate/ReturnCheck.hpp \
    56         Validate/VerifyCtorDtorAssign.cpp \
    57         Validate/VerifyCtorDtorAssign.hpp
     47        Validate/ReturnCheck.hpp
    5848
    5949SRCDEMANGLE += $(SRC_VALIDATE)
  • src/main.cc

    rd4b37ab r25404c7  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Jul 12 12:02:00 2022
    13 // Update Count     : 675
     12// Last Modified On : Tue Jun  7 13:29:00 2022
     13// Update Count     : 674
    1414//
    1515
     
    7878#include "Validate/CompoundLiteral.hpp"     // for handleCompoundLiterals
    7979#include "Validate/EliminateTypedef.hpp"    // for eliminateTypedef
    80 #include "Validate/EnumAndPointerDecay.hpp" // for decayEnumsAndPointers
    8180#include "Validate/FindSpecialDecls.h"      // for findGlobalDecls
    8281#include "Validate/FixQualifiedTypes.hpp"   // for fixQualifiedTypes
    83 #include "Validate/FixReturnTypes.hpp"      // for fixReturnTypes
    8482#include "Validate/ForallPointerDecay.hpp"  // for decayForallPointers
    8583#include "Validate/GenericParameter.hpp"    // for fillGenericParameters, tr...
    8684#include "Validate/HoistStruct.hpp"         // for hoistStruct
    87 #include "Validate/HoistTypeDecls.hpp"      // for hoistTypeDecls
    8885#include "Validate/InitializerLength.hpp"   // for setLengthFromInitializer
    8986#include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
    9087#include "Validate/LinkReferenceToTypes.hpp" // for linkReferenceToTypes
    91 #include "Validate/ReplaceTypedef.hpp"      // for replaceTypedef
    9288#include "Validate/ReturnCheck.hpp"         // for checkReturnStatements
    93 #include "Validate/VerifyCtorDtorAssign.hpp" // for verifyCtorDtorAssign
    9489#include "Virtual/ExpandCasts.h"            // for expandCasts
    9590
     
    336331                } // if
    337332
     333                // add the assignment statement after the initialization of a type parameter
     334                PASS( "Validate-A", SymTab::validate_A( translationUnit ) );
     335
    338336                CodeTools::fillLocations( translationUnit );
    339337
     
    348346
    349347                        forceFillCodeLocations( transUnit );
    350 
    351                         // Must happen before auto-gen, or anything that examines ops.
    352                         PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );
    353 
    354                         PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
    355                         // Hoist Type Decls pulls some declarations out of contexts where
    356                         // locations are not tracked. Perhaps they should be, but for now
    357                         // the full fill solves it.
    358                         forceFillCodeLocations( transUnit );
    359 
    360                         PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );
    361 
    362                         // Must happen before auto-gen.
    363                         PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );
    364 
    365                         // Must happen before Link Reference to Types, it needs correct
    366                         // types for mangling.
    367                         PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers( transUnit ) );
    368348
    369349                        // Must happen before auto-gen, because it uses the sized flag.
     
    473453                        translationUnit = convert( move( transUnit ) );
    474454                } else {
    475                         // add the assignment statement after the initialization of a type parameter
    476                         PASS( "Validate", SymTab::validate( translationUnit ) );
     455                        PASS( "Validate-B", SymTab::validate_B( translationUnit ) );
     456                        PASS( "Validate-C", SymTab::validate_C( translationUnit ) );
     457                        PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
     458                        PASS( "Validate-E", SymTab::validate_E( translationUnit ) );
     459                        PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
    477460
    478461                        if ( symtabp ) {
Note: See TracChangeset for help on using the changeset viewer.