- Timestamp:
- Dec 22, 2022, 3:17:52 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 64b3cda
- Parents:
- be3b952
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/RunParser.cpp
rbe3b952 r019b2d3 10 10 // Created On : Mon Dec 19 11:00:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Dec 19 11:15:00 202213 // Update Count : 012 // Last Modified On : Thr Dec 22 10:18:00 2022 13 // Update Count : 1 14 14 // 15 15 16 16 #include "RunParser.hpp" 17 17 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 18 22 #include "Parser/ParseNode.h" // for DeclarationNode, buildList 19 23 #include "Parser/TypedefTable.h" // for TypedefTable … … 47 51 } 48 52 49 std::list<Declaration *>buildUnit(void) {53 ast::TranslationUnit buildUnit(void) { 50 54 std::list<Declaration *> translationUnit; 51 55 buildList( parseTree, translationUnit ); … … 54 58 parseTree = nullptr; 55 59 56 return translationUnit; 60 // When the parse/buildList code is translated to the new ast, these 61 // fill passes (and the one after 'Hoist Type Decls') should be redundent 62 // because the code locations should already be filled. 63 CodeTools::fillLocations( translationUnit ); 64 ast::TranslationUnit transUnit = convert( std::move( translationUnit ) ); 65 forceFillCodeLocations( transUnit ); 66 return transUnit; 57 67 } 58 68 -
src/Parser/RunParser.hpp
rbe3b952 r019b2d3 10 10 // Created On : Mon Dec 19 10:42:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Dec 19 11:15:00 202213 // Update Count : 012 // Last Modified On : Thr Dec 22 10:23:00 2022 13 // Update Count : 1 14 14 // 15 15 … … 17 17 18 18 #include <iosfwd> // for ostream 19 #include <list> // for list20 19 21 20 #include "SynTree/LinkageSpec.h" // for Spec 22 class Declaration; 21 namespace ast { 22 class TranslationUnit; 23 } 23 24 24 25 // The Parser does not have an enclosing namespace. … … 35 36 /// Drain the internal accumulator of parsed code and build a translation 36 37 /// unit from it. 37 std::list<Declaration *>buildUnit(void);38 ast::TranslationUnit buildUnit(void); 38 39 39 40 // Local Variables: // -
src/main.cc
rbe3b952 r019b2d3 299 299 } // if 300 300 301 translationUnit = buildUnit();301 auto transUnit = buildUnit(); 302 302 303 303 if ( astp ) { 304 dump( translationUnit ); 305 return EXIT_SUCCESS; 306 } // if 307 308 // Temporary: fill locations after parsing so that every node has a location, for early error messages. 309 // Eventually we should pass the locations from the parser to every node, but this quick and dirty solution 310 // works okay for now. 311 CodeTools::fillLocations( translationUnit ); 304 dump( std::move( transUnit ) ); 305 return EXIT_SUCCESS; 306 } // if 307 312 308 Stats::Time::StopBlock(); 313 309 … … 316 312 ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New"); 317 313 } 318 auto transUnit = convert( std::move( translationUnit ) );319 320 forceFillCodeLocations( transUnit );321 314 322 315 PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
Note: See TracChangeset
for help on using the changeset viewer.