Changeset ce36b55


Ignore:
Timestamp:
Nov 15, 2021, 2:51:44 PM (8 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
enum, forall-pointer-decay, master
Children:
1387ea0
Parents:
5dcb881
Message:

Translation of Validate F; and some improvements in some helpers.

Location:
src
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Copy.cpp

    r5dcb881 rce36b55  
    105105}
    106106
    107 Node * deepCopyNode( const Node * localRoot ) {
     107template<>
     108Node * deepCopy<Node>( const Node * localRoot ) {
    108109        Pass< DeepCopyCore > dc;
    109110        Node const * newRoot = localRoot->accept( dc );
  • src/AST/Copy.hpp

    r5dcb881 rce36b55  
    4444}
    4545
    46 Node * deepCopyNode( const Node * node );
    47 
    4846template<typename node_t>
    4947node_t * deepCopy( const node_t * localRoot ) {
    50         return strict_dynamic_cast<node_t *>( deepCopyNode( localRoot ) );
     48        return strict_dynamic_cast<node_t *>( deepCopy<Node>( localRoot ) );
    5149}
     50
     51template<>
     52Node * deepCopy<Node>( const Node * localRoot );
    5253
    5354}
  • src/AST/Init.hpp

    r5dcb881 rce36b55  
    9898        const_iterator begin() const { return initializers.begin(); }
    9999        const_iterator end() const { return initializers.end(); }
     100        size_t size() const { return initializers.size(); }
    100101
    101102        const Init * accept( Visitor & v ) const override { return v.visit( this ); }
  • src/AST/Pass.hpp

    r5dcb881 rce36b55  
    109109        static auto read( node_type const * node, Args&&... args ) {
    110110                Pass<core_t> visitor( std::forward<Args>( args )... );
    111                 node_type const * temp = node->accept( visitor );
     111                auto const * temp = node->accept( visitor );
    112112                assert( temp == node );
    113113                return visitor.get_result();
     
    124124        static auto read( node_type const * node ) {
    125125                Pass<core_t> visitor;
    126                 node_type const * temp = node->accept( visitor );
     126                auto const * temp = node->accept( visitor );
    127127                assert( temp == node );
    128128                return visitor.get_result();
  • src/InitTweak/FixInitNew.cpp

    r5dcb881 rce36b55  
    591591                // need to add __Destructor for _tmp_cp variables as well
    592592
    593                 assertf( ast::dtorStruct && ast::dtorStruct->members.size() == 2, "Destructor generation requires __Destructor definition." );
     593                assertf( ast::dtorStruct, "Destructor generation requires __Destructor definition." );
     594                assertf( ast::dtorStruct->members.size() == 2, "__Destructor definition does not have expected fields." );
    594595                assertf( ast::dtorStructDestroy, "Destructor generation requires __destroy_Destructor." );
    595596
     
    12161217
    12171218                                                        static UniqueName memberDtorNamer = { "__memberDtor" };
    1218                                                         assertf( Validate::dtorStruct, "builtin __Destructor not found." );
    1219                                                         assertf( Validate::dtorStructDestroy, "builtin __destroy_Destructor not found." );
     1219                                                        assertf( ast::dtorStruct, "builtin __Destructor not found." );
     1220                                                        assertf( ast::dtorStructDestroy, "builtin __destroy_Destructor not found." );
    12201221
    12211222                                                        ast::Expr * thisExpr = new ast::CastExpr( new ast::AddressExpr( new ast::VariableExpr(loc, thisParam ) ), new ast::PointerType( new ast::VoidType(), ast::CV::Qualifiers() ) );
  • src/Validate/FindSpecialDecls.h

    r5dcb881 rce36b55  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Aug 30 09:49:02 2018
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Aug 30 09:51:12 2018
    13 // Update Count     : 2
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Nov 10 15:16:00 2021
     13// Update Count     : 3
    1414//
    1515
     
    2222class StructDecl;
    2323class Type;
     24
     25namespace ast {
     26        class TranslationUnit;
     27}
    2428
    2529namespace Validate {
     
    3842        /// find and remember some of the special declarations that are useful for generating code, so that they do not have to be discovered multiple times.
    3943        void findSpecialDecls( std::list< Declaration * > & translationUnit );
     44
     45/// find and remember some of the special declarations that are useful for
     46/// generating code, so that they do not have to be discovered multiple times.
     47void findGlobalDecls( ast::TranslationUnit & translationUnit );
     48
    4049} // namespace Validate
    4150
  • src/Validate/module.mk

    r5dcb881 rce36b55  
    1515###############################################################################
    1616
    17 SRC += Validate/HandleAttributes.cc Validate/HandleAttributes.h Validate/FindSpecialDecls.cc Validate/FindSpecialDecls.h
    18 SRCDEMANGLE += Validate/HandleAttributes.cc Validate/HandleAttributes.h Validate/FindSpecialDecls.cc Validate/FindSpecialDecls.h
     17SRC_VALIDATE = \
     18        Validate/HandleAttributes.cc \
     19        Validate/HandleAttributes.h \
     20        Validate/InitializerLength.cpp \
     21        Validate/InitializerLength.hpp \
     22        Validate/LabelAddressFixer.cpp \
     23        Validate/LabelAddressFixer.hpp \
     24        Validate/FindSpecialDeclsNew.cpp \
     25        Validate/FindSpecialDecls.cc \
     26        Validate/FindSpecialDecls.h
     27
     28SRC += $(SRC_VALIDATE)
     29SRCDEMANGLE += $(SRC_VALIDATE)
  • src/main.cc

    r5dcb881 rce36b55  
    7272#include "SynTree/Visitor.h"                // for acceptAll
    7373#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
     74#include "Validate/FindSpecialDecls.h"      // for findGlobalDecls
     75#include "Validate/InitializerLength.hpp"   // for setLengthFromInitializer
     76#include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
    7477#include "Virtual/ExpandCasts.h"            // for expandCasts
    7578
     
    323326                PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
    324327                PASS( "Validate-E", SymTab::validate_E( translationUnit ) );
    325                 PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
    326328
    327329                CodeTools::fillLocations( translationUnit );
     
    336338                        forceFillCodeLocations( transUnit );
    337339
     340                        PASS( "Set Length From Initializer", Validate::setLengthFromInitializer( transUnit ) );
     341                        PASS( "Find Global Decls", Validate::findGlobalDecls( transUnit ) );
     342                        PASS( "Fix Label Address", Validate::fixLabelAddresses( transUnit ) );
     343
    338344                        if ( symtabp ) {
    339345                                return EXIT_SUCCESS;
     
    396402                        translationUnit = convert( move( transUnit ) );
    397403                } else {
     404                        PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
     405
    398406                        if ( symtabp ) {
    399407                                deleteAll( translationUnit );
Note: See TracChangeset for help on using the changeset viewer.