LLVM 22.0.0git
FileLoc.h
Go to the documentation of this file.
1//===-- FileLoc.h ---------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_ASMPARSER_FILELOC_H
10#define LLVM_ASMPARSER_FILELOC_H
11
12#include <cassert>
13#include <utility>
14
15namespace llvm {
16
17/// Struct holding Line:Column location
18struct FileLoc {
19 /// 0-based line number
20 unsigned Line;
21 /// 0-based column number
22 unsigned Col;
23
24 bool operator==(const FileLoc &RHS) const {
25 return Line == RHS.Line && Col == RHS.Col;
26 }
27
28 bool operator<=(const FileLoc &RHS) const {
29 return Line < RHS.Line || (Line == RHS.Line && Col <= RHS.Col);
30 }
31
32 bool operator<(const FileLoc &RHS) const {
33 return Line < RHS.Line || (Line == RHS.Line && Col < RHS.Col);
34 }
35
36 FileLoc() : Line(0), Col(0) {}
37 FileLoc(unsigned L, unsigned C) : Line(L), Col(C) {}
38 FileLoc(std::pair<unsigned, unsigned> LC) : Line(LC.first), Col(LC.second) {}
39};
40
41/// Struct holding a semiopen range [Start; End)
45
46 FileLocRange() : Start(0, 0), End(0, 0) {}
47
49 assert(Start <= End);
50 }
51
52 bool contains(FileLoc L) const { return Start <= L && L < End; }
53
54 bool contains(FileLocRange LR) const {
55 return Start <= LR.Start && LR.End <= End;
56 }
57};
58
59} // namespace llvm
60
61#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Value * RHS
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
bool contains(FileLoc L) const
Definition FileLoc.h:52
bool contains(FileLocRange LR) const
Definition FileLoc.h:54
FileLocRange(FileLoc S, FileLoc E)
Definition FileLoc.h:48
Struct holding Line:Column location.
Definition FileLoc.h:18
FileLoc(std::pair< unsigned, unsigned > LC)
Definition FileLoc.h:38
unsigned Col
0-based column number
Definition FileLoc.h:22
FileLoc(unsigned L, unsigned C)
Definition FileLoc.h:37
bool operator<=(const FileLoc &RHS) const
Definition FileLoc.h:28
bool operator<(const FileLoc &RHS) const
Definition FileLoc.h:32
bool operator==(const FileLoc &RHS) const
Definition FileLoc.h:24
unsigned Line
0-based line number
Definition FileLoc.h:20