Changeset d99a716 for src/Parser


Ignore:
Timestamp:
Jan 4, 2023, 1:44:19 PM (3 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master, stuck-waitfor-destruct
Children:
339e30a, a14926b
Parents:
0348fd8 (diff), 66a89e7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/RunParser.cpp

    r0348fd8 rd99a716  
    1010// Created On       : Mon Dec 19 11:00:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Dec 19 11:15:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Thr Dec 22 10:18:00 2022
     13// Update Count     : 1
    1414//
    1515
    1616#include "RunParser.hpp"
    1717
     18#include "AST/Convert.hpp"                  // for convert
     19#include "AST/TranslationUnit.hpp"          // for TranslationUnit
     20#include "CodeTools/TrackLoc.h"             // for fillLocations
     21#include "Common/CodeLocationTools.hpp"     // for forceFillCodeLocations
    1822#include "Parser/ParseNode.h"               // for DeclarationNode, buildList
    1923#include "Parser/TypedefTable.h"            // for TypedefTable
     
    4145} // parse
    4246
    43 void dumpParseTree( std::ostream & out ) {
    44         parseTree->printList( out );
    45         delete parseTree;
    46         parseTree = nullptr;
    47 }
    48 
    49 std::list<Declaration *> buildUnit(void) {
     47ast::TranslationUnit buildUnit(void) {
    5048        std::list<Declaration *> translationUnit;
    5149        buildList( parseTree, translationUnit );
     
    5452        parseTree = nullptr;
    5553
    56         return translationUnit;
     54        // When the parse/buildList code is translated to the new ast, these
     55        // fill passes (and the one after 'Hoist Type Decls') should be redundent
     56        // because the code locations should already be filled.
     57        CodeTools::fillLocations( translationUnit );
     58        ast::TranslationUnit transUnit = convert( std::move( translationUnit ) );
     59        forceFillCodeLocations( transUnit );
     60        return transUnit;
    5761}
    5862
  • src/Parser/RunParser.hpp

    r0348fd8 rd99a716  
    1010// Created On       : Mon Dec 19 10:42:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Dec 19 11:15:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Thr Dec 22 10:23:00 2022
     13// Update Count     : 1
    1414//
    1515
     
    1717
    1818#include <iosfwd>                           // for ostream
    19 #include <list>                             // for list
    2019
    2120#include "SynTree/LinkageSpec.h"            // for Spec
    22 class Declaration;
     21namespace ast {
     22        class TranslationUnit;
     23}
    2324
    2425// The Parser does not have an enclosing namespace.
     
    3031void parse( FILE * input, LinkageSpec::Spec linkage, bool alwaysExit = false );
    3132
    32 /// Drain the internal accumulator of parsed code and print it to the stream.
    33 void dumpParseTree( std::ostream & );
    34 
    3533/// Drain the internal accumulator of parsed code and build a translation
    3634/// unit from it.
    37 std::list<Declaration *> buildUnit(void);
     35ast::TranslationUnit buildUnit(void);
    3836
    3937// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.