Changeset d48e529 for src/Common
- Timestamp:
- Sep 19, 2017, 1:22:51 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:
- a9a4771
- Parents:
- 4e8949f
- Location:
- src/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocation.h
r4e8949f rd48e529 20 20 21 21 struct CodeLocation { 22 int linenumber;23 std::string filename ;22 int first_line = -1, first_column = -1, last_line = -1, last_column = -1; 23 std::string filename = ""; 24 24 25 25 /// Create a new unset CodeLocation. 26 CodeLocation() 27 : linenumber( -1 ) 28 , filename("") 29 {} 26 CodeLocation() = default; 30 27 31 28 /// Create a new CodeLocation with the given values. 32 29 CodeLocation( const char* filename, int lineno ) 33 : linenumber( lineno )30 : first_line( lineno ) 34 31 , filename(filename ? filename : "") 35 32 {} … … 38 35 39 36 bool isSet () const { 40 return -1 != linenumber;37 return -1 != first_line; 41 38 } 42 39 … … 46 43 47 44 bool followedBy( CodeLocation const & other, int seperation ) { 48 return ( linenumber + seperation == other.linenumber&&45 return (first_line + seperation == other.first_line && 49 46 filename == other.filename); 50 47 } … … 61 58 inline std::ostream & operator<<( std::ostream & out, const CodeLocation & location ) { 62 59 // 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;60 return location.isSet() ? out << location.filename << ":" << location.first_line << ":1 " : out; 64 61 } -
src/Common/SemanticError.h
r4e8949f rd48e529 32 32 33 33 void maybeSet( const CodeLocation & location ) { 34 if( this->location. linenumber < 0) {34 if( this->location.isUnset() ) { 35 35 this->location = location; 36 36 }
Note: See TracChangeset
for help on using the changeset viewer.