Ignore:
Timestamp:
Sep 18, 2017, 4:56:22 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
4e8949f
Parents:
698ec72
Message:

Begin to clean up CodeLocations?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/CodeLocation.h

    r698ec72 r80ac42d  
    1616#pragma once
    1717
     18#include <iostream>
    1819#include <string>
    1920
     
    4445        }
    4546
    46         void unset () {
    47                 linenumber = -1;
    48                 filename = "";
    49         }
    50 
    51         // Use field access for set.
    52 
    5347        bool followedBy( CodeLocation const & other, int seperation ) {
    5448                return (linenumber + seperation == other.linenumber &&
     
    6559};
    6660
    67 inline std::string to_string( const CodeLocation& location ) {
    68     // Column number ":1" allows IDEs to parse the error message and position the cursor in the source text.
    69     return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + ":1 " : "";
     61inline 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;
    7064}
    71 
Note: See TracChangeset for help on using the changeset viewer.