• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
16 #define COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
17 
18 namespace pp
19 {
20 
21 struct SourceLocation
22 {
SourceLocationSourceLocation23 	SourceLocation() : file(0), line(0) { }
SourceLocationSourceLocation24 	SourceLocation(int f, int l) : file(f), line(l) { }
25 
equalsSourceLocation26 	bool equals(const SourceLocation& other) const
27 	{
28 		return (file == other.file) && (line == other.line);
29 	}
30 
31 	int file;
32 	int line;
33 };
34 
35 inline bool operator==(const SourceLocation& lhs, const SourceLocation& rhs)
36 {
37 	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 #endif  // COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
47