Eliminate source_location in favor of location_t
[official-gcc.git] / gcc / go / go-location.h
blob6637b86d0858027b79ab6c526a71215896700e23
1 // go-location.h -- GCC specific Location declaration. -*- C++ -*-
3 // Copyright 2011 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 #ifndef GO_LOCATION_H
8 #define GO_LOCATION_H
10 #include "go-system.h"
12 // A location in an input source file.
14 class Location
16 public:
17 Location()
18 : gcc_loc_(UNKNOWN_LOCATION)
19 { }
21 explicit Location(location_t loc)
22 : gcc_loc_(loc)
23 { }
25 location_t
26 gcc_location() const
27 { return this->gcc_loc_; }
29 private:
30 location_t gcc_loc_;
33 // The Go frontend requires the ability to compare Locations.
35 inline bool
36 operator<(Location loca, Location locb)
38 return loca.gcc_location() < locb.gcc_location();
41 inline bool
42 operator==(Location loca, Location locb)
44 return loca.gcc_location() == locb.gcc_location();
47 #endif // !defined(GO_LOCATION_H)