Ignore:
Timestamp:
Apr 21, 2023, 5:36:12 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, master
Children:
28f8f15, 6e4c44d
Parents:
2ed94a9 (diff), 699a97d (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/RunParser.cpp

    r2ed94a9 rb110bcc  
    1010// Created On       : Mon Dec 19 11:00:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Dec 22 10:18:00 2022
    13 // Update Count     : 1
     12// Last Modified On : Mon Mar  6  9:42:00 2023
     13// Update Count     : 3
    1414//
    1515
     
    2020#include "CodeTools/TrackLoc.h"             // for fillLocations
    2121#include "Common/CodeLocationTools.hpp"     // for forceFillCodeLocations
    22 #include "Parser/ParseNode.h"               // for DeclarationNode, buildList
     22#include "Parser/DeclarationNode.h"         // for DeclarationNode, buildList
    2323#include "Parser/TypedefTable.h"            // for TypedefTable
    2424
    2525// Variables global to the parsing code.
    26 LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     26ast::Linkage::Spec linkage = ast::Linkage::Cforall;
    2727TypedefTable typedefTable;
    2828DeclarationNode * parseTree = nullptr;
    2929
    30 void parse( FILE * input, LinkageSpec::Spec linkage, bool alwaysExit ) {
     30void parse( FILE * input, ast::Linkage::Spec linkage, bool alwaysExit ) {
    3131        extern int yyparse( void );
    3232        extern FILE * yyin;
     
    4646
    4747ast::TranslationUnit buildUnit(void) {
    48         std::list<Declaration *> translationUnit;
    49         buildList( parseTree, translationUnit );
    50 
     48        std::vector<ast::ptr<ast::Decl>> decls;
     49        buildList( parseTree, decls );
    5150        delete parseTree;
    5251        parseTree = nullptr;
    5352
    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 );
     53        ast::TranslationUnit transUnit;
     54        for ( auto decl : decls ) {
     55                transUnit.decls.emplace_back( std::move( decl ) );
     56        }
    6057        return transUnit;
    6158}
Note: See TracChangeset for help on using the changeset viewer.