Changeset 0dd18fd
- Timestamp:
- Aug 18, 2017, 4:01:06 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 5916272
- Parents:
- 8bafacc
- Location:
- src/CodeGen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r8bafacc r0dd18fd 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 18 1 4:20:00 201713 // Update Count : 48 712 // Last Modified On : Fri Aug 18 15:34:00 2017 13 // Update Count : 488 14 14 // 15 15 #include "CodeGenerator.h" … … 77 77 } // for 78 78 return output; 79 }80 81 CodeGenerator::LineMarker::LineMarker(82 CodeLocation const & loc, bool toPrint) :83 loc(loc), toPrint(toPrint)84 {}85 86 CodeGenerator::LineMarker CodeGenerator::lineDirective(87 BaseSyntaxNode const * node) {88 return LineMarker(node->location, lineMarks);89 }90 91 std::ostream & operator<<(std::ostream & out,92 CodeGenerator::LineMarker const & marker) {93 if (marker.toPrint && marker.loc.isSet()) {94 return out << "\n# " << marker.loc.linenumber << " \""95 << marker.loc.filename << "\"\n";96 } else if (marker.toPrint) {97 return out << "\n/* Missing CodeLocation */\n";98 } else {99 return out;100 }101 79 } 102 80 -
src/CodeGen/CodeGenerator.h
r8bafacc r0dd18fd 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 18 1 3:52:00 201713 // Update Count : 5 512 // Last Modified On : Fri Aug 18 15:40:00 2017 13 // Update Count : 56 14 14 // 15 15 … … 108 108 }; 109 109 110 struct LineMarker {111 CodeLocation const & loc;112 bool toPrint;113 114 LineMarker(CodeLocation const & loc, bool toPrint);115 };116 117 LineMarker lineDirective(BaseSyntaxNode const * node);118 119 110 void asmName( DeclarationWithType *decl ); 120 111 121 112 void extension( Expression *expr ); 122 113 void extension( Declaration *decl ); 114 115 void updateLocation( BaseSyntaxNode const * to ); 123 116 private: 124 117 Indenter indent; … … 132 125 CodeLocation currentLocation; 133 126 void updateLocation( CodeLocation const & to ); 134 void updateLocation( BaseSyntaxNode const * to );135 127 void nextLine(); 136 128 … … 160 152 /// returns C-compatible name of declaration 161 153 std::string genName( DeclarationWithType * decl ); 162 163 std::ostream & operator<<(std::ostream &,164 CodeGenerator::LineMarker const &);165 154 } // namespace CodeGen 166 155 -
src/CodeGen/Generate.cc
r8bafacc r0dd18fd 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 19 13:05:00 201713 // Update Count : 612 // Last Modified On : Fri Aug 18 15:39:00 2017 13 // Update Count : 7 14 14 // 15 15 #include "Generate.h" … … 33 33 for ( auto & dcl : translationUnit ) { 34 34 if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) { 35 os << cgv.lineDirective(dcl);35 cgv.updateLocation( dcl ); 36 36 dcl->accept(cgv); 37 37 if ( doSemicolon( dcl ) ) {
Note: See TracChangeset
for help on using the changeset viewer.