blob: 61d1af057cd1805dd7e3bd8aed5d2b6c7e5512e1 [file] [log] [blame]
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001//
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 Lang0a73dd82014-11-19 16:18:08 -05007#ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
8#define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00009
Geoff Lang197d5292018-04-25 14:29:00 -040010namespace angle
11{
12
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000013namespace pp
14{
15
16struct SourceLocation
17{
Jamie Madillf832c9d2016-12-12 17:38:48 -050018 SourceLocation() : file(0), line(0) {}
19 SourceLocation(int f, int l) : file(f), line(l) {}
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000020
Zhenyao Mod526f982014-05-13 14:51:19 -070021 bool equals(const SourceLocation &other) const
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000022 {
23 return (file == other.file) && (line == other.line);
24 }
25
26 int file;
27 int line;
28};
29
Zhenyao Mod526f982014-05-13 14:51:19 -070030inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000031{
32 return lhs.equals(rhs);
33}
34
Zhenyao Mod526f982014-05-13 14:51:19 -070035inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000036{
37 return !lhs.equals(rhs);
38}
39
40} // namespace pp
Geoff Lang0a73dd82014-11-19 16:18:08 -050041
Geoff Lang197d5292018-04-25 14:29:00 -040042} // namespace angle
43
Geoff Lang0a73dd82014-11-19 16:18:08 -050044#endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_