Changeset 33b7d49 for src/AST/Util.cpp


Ignore:
Timestamp:
Mar 15, 2022, 10:14:05 AM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
48a91e2
Parents:
d824715
Message:

Added another check to checkInvariants for code locations. I also went through and made sure you can put it every after every new AST pass not followed by a forceFillCodeLocations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Util.cpp

    rd824715 r33b7d49  
    1010// Created On       : Wed Jan 19  9:46:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Feb 18  9:42:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Fri Mar 11 18:07:00 2022
     13// Update Count     : 1
    1414//
    1515
    1616#include "Util.hpp"
    1717
    18 #include "Decl.hpp"
    1918#include "Node.hpp"
     19#include "ParseNode.hpp"
    2020#include "Pass.hpp"
    2121#include "TranslationUnit.hpp"
    22 #include "Common/ScopedMap.h"
    2322
    2423#include <vector>
     
    4645};
    4746
     47/// Check that every note that can has a set CodeLocation.
     48struct SetCodeLocationsCore {
     49        void previsit( const ParseNode * node ) {
     50                assert( node->location.isSet() );
     51        }
     52};
     53
    4854struct InvariantCore {
    4955        // To save on the number of visits: this is a kind of composed core.
    5056        // None of the passes should make changes so ordering doesn't matter.
    5157        NoStrongCyclesCore no_strong_cycles;
     58        SetCodeLocationsCore set_code_locations;
    5259
    5360        void previsit( const Node * node ) {
    5461                no_strong_cycles.previsit( node );
     62        }
     63
     64        void previsit( const ParseNode * node ) {
     65                no_strong_cycles.previsit( node );
     66                set_code_locations.previsit( node );
    5567        }
    5668
Note: See TracChangeset for help on using the changeset viewer.