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 || (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 FileLoc(unsigned L, unsigned C) : Line(L), Col(C) {}
33 FileLoc(std::pair<unsigned, unsigned> LC) : Line(LC.first), Col(LC.second) {}
34};
35
36/// Struct holding a semiopen range [Start; End)
40
41 FileLocRange() : Start(0, 0), End(0, 0) {}
42
44 assert(Start <= End);
45 }
46
47 bool contains(FileLoc L) const { return Start <= L && L < End; }
48
49 bool contains(FileLocRange LR) const {
50 return Start <= LR.Start && LR.End <= End;
51 }
52};
53
54} // namespace llvm
55
56#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:47
bool contains(FileLocRange LR) const
Definition FileLoc.h:49
FileLocRange(FileLoc S, FileLoc E)
Definition FileLoc.h:43
Struct holding Line:Column location.
Definition FileLoc.h:18
FileLoc(std::pair< unsigned, unsigned > LC)
Definition FileLoc.h:33
unsigned Col
0-based column number
Definition FileLoc.h:22
FileLoc(unsigned L, unsigned C)
Definition FileLoc.h:32
bool operator<=(const FileLoc &RHS) const
Definition FileLoc.h:24
bool operator<(const FileLoc &RHS) const
Definition FileLoc.h:28
unsigned Line
0-based line number
Definition FileLoc.h:20