Line data Source code
1 : //
2 : // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3 : // Use of this source code is governed by a BSD-style license that can be
4 : // found in the LICENSE file.
5 : //
6 :
7 : #ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
8 : #define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
9 :
10 : namespace pp
11 : {
12 :
13 : struct SourceLocation
14 : {
15 0 : SourceLocation()
16 0 : : file(0),
17 0 : line(0)
18 : {
19 0 : }
20 0 : SourceLocation(int f, int l)
21 0 : : file(f),
22 0 : line(l)
23 : {
24 0 : }
25 :
26 0 : bool equals(const SourceLocation &other) const
27 : {
28 0 : return (file == other.file) && (line == other.line);
29 : }
30 :
31 : int file;
32 : int line;
33 : };
34 :
35 0 : inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
36 : {
37 0 : return lhs.equals(rhs);
38 : }
39 :
40 : inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
41 : {
42 : return !lhs.equals(rhs);
43 : }
44 :
45 : } // namespace pp
46 :
47 : #endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_
|