Changeset 80ac42d for src/Common/CodeLocation.h
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.