alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 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 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_ |
| 8 | #define COMPILER_PREPROCESSOR_SOURCELOCATION_H_ |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 9 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 10 | namespace angle |
| 11 | { |
| 12 | |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 13 | namespace pp |
| 14 | { |
| 15 | |
| 16 | struct SourceLocation |
| 17 | { |
Jamie Madill | f832c9d | 2016-12-12 17:38:48 -0500 | [diff] [blame] | 18 | SourceLocation() : file(0), line(0) {} |
| 19 | SourceLocation(int f, int l) : file(f), line(l) {} |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 20 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 21 | bool equals(const SourceLocation &other) const |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 22 | { |
| 23 | return (file == other.file) && (line == other.line); |
| 24 | } |
| 25 | |
| 26 | int file; |
| 27 | int line; |
| 28 | }; |
| 29 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 30 | inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs) |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 31 | { |
| 32 | return lhs.equals(rhs); |
| 33 | } |
| 34 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 35 | inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs) |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 36 | { |
| 37 | return !lhs.equals(rhs); |
| 38 | } |
| 39 | |
| 40 | } // namespace pp |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 41 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 42 | } // namespace angle |
| 43 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 44 | #endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_ |