comparison gcc/go/go-location.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // go-location.h -- GCC specific Location declaration. -*- C++ -*-
2
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.
6
7 #ifndef GO_LOCATION_H
8 #define GO_LOCATION_H
9
10 #include "go-system.h"
11
12 // A location in an input source file.
13
14 class Location
15 {
16 public:
17 Location()
18 : gcc_loc_(UNKNOWN_LOCATION)
19 { }
20
21 explicit Location(source_location loc)
22 : gcc_loc_(loc)
23 { }
24
25 source_location
26 gcc_location() const
27 { return this->gcc_loc_; }
28
29 private:
30 source_location gcc_loc_;
31 };
32
33 // The Go frontend requires the ability to compare Locations.
34
35 inline bool
36 operator<(Location loca, Location locb)
37 {
38 return loca.gcc_location() < locb.gcc_location();
39 }
40
41 inline bool
42 operator==(Location loca, Location locb)
43 {
44 return loca.gcc_location() == locb.gcc_location();
45 }
46
47 #endif // !defined(GO_LOCATION_H)