Changeset 80ac42d
- Timestamp:
- Sep 18, 2017, 4:56:22 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:
- 4e8949f
- Parents:
- 698ec72
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeTools/TrackLoc.cc
r698ec72 r80ac42d 33 33 34 34 namespace CodeTools { 35 36 std::ostream & operator<<(std::ostream & out, CodeLocation const & loc) {37 return out << loc.filename << '[' << loc.linenumber << ']';38 }39 40 35 class LocationPrinter { 41 36 size_t printLevel; … … 95 90 acceptAll( translationUnit, printer ); 96 91 } 97 98 92 } // namespace CodeTools 99 93 -
src/Common/CodeLocation.h
r698ec72 r80ac42d 16 16 #pragma once 17 17 18 #include <iostream> 18 19 #include <string> 19 20 … … 44 45 } 45 46 46 void unset () {47 linenumber = -1;48 filename = "";49 }50 51 // Use field access for set.52 53 47 bool followedBy( CodeLocation const & other, int seperation ) { 54 48 return (linenumber + seperation == other.linenumber && … … 65 59 }; 66 60 67 inline std:: string to_string( const CodeLocation& location ) {68 69 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + ":1 " : "";61 inline std::ostream & operator<<( std::ostream & out, const CodeLocation & location ) { 62 // Column number ":1" allows IDEs to parse the error message and position the cursor in the source text. 63 return location.isSet() ? out << location.filename << ":" << location.linenumber << ":1 " : out; 70 64 } 71 -
src/Common/SemanticError.cc
r698ec72 r80ac42d 45 45 using std::to_string; 46 46 for( auto err : errors ) { 47 os << to_string( err.location )<< err.description << std::endl;47 os << err.location << err.description << std::endl; 48 48 } 49 49 }
Note: See TracChangeset
for help on using the changeset viewer.