blob: 51908a3b4bd3ab5057f6ed51af672ffa64feed21 [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
10namespace pp
11{
12
13struct SourceLocation
14{
Jamie Madillf832c9d2016-12-12 17:38:48 -050015 SourceLocation() : file(0), line(0) {}
16 SourceLocation(int f, int l) : file(f), line(l) {}
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000017
Zhenyao Mod526f982014-05-13 14:51:19 -070018 bool equals(const SourceLocation &other) const
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000019 {
20 return (file == other.file) && (line == other.line);
21 }
22
23 int file;
24 int line;
25};
26
Zhenyao Mod526f982014-05-13 14:51:19 -070027inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000028{
29 return lhs.equals(rhs);
30}
31
Zhenyao Mod526f982014-05-13 14:51:19 -070032inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
alokp@chromium.org2c958ee2012-05-17 20:35:42 +000033{
34 return !lhs.equals(rhs);
35}
36
37} // namespace pp
Geoff Lang0a73dd82014-11-19 16:18:08 -050038
39#endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_