GCC Middle and Back End API Reference
physical-location-maker.h
Go to the documentation of this file.
1/* Convenient but inefficient creation of location_t values.
2 Copyright (C) 2023-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_DIAGNOSTICS_PHYSICAL_LOCATION_MAKER_H
21#define GCC_DIAGNOSTICS_PHYSICAL_LOCATION_MAKER_H
22
23namespace diagnostics {
24
25/* A class for generating location_t values for arbitrary
26 filename/line/column values.
27 This is less efficient than working with the line_maps
28 directly, but is more convenient and flexible for occasional
29 on-demand location_t values. */
30
32{
33public:
34 physical_location_maker (line_maps *line_table_)
35 : m_line_table (line_table_)
36 {
37 }
38
39 location_t
40 new_location_from_file_and_line (const char *filename,
41 int line_num);
42
43 /* column_num is 1-based. */
44 location_t
45 new_location_from_file_line_column (const char *filename,
46 int line_num,
47 int column_num);
48
49private:
50 void
51 ensure_linemap_for_file_and_line (const char *filename,
52 int linenum);
53
54private:
55 line_maps *m_line_table;
56};
57
58} // namespace diagnostics
59
60#endif // #ifndef GCC_DIAGNOSTICS_PHYSICAL_LOCATION_MAKER_H
void ensure_linemap_for_file_and_line(const char *filename, int linenum)
Definition physical-location-maker.cc:52
location_t new_location_from_file_line_column(const char *filename, int line_num, int column_num)
Definition physical-location-maker.cc:42
physical_location_maker(line_maps *line_table_)
Definition physical-location-maker.h:34
location_t new_location_from_file_and_line(const char *filename, int line_num)
Definition physical-location-maker.cc:33
line_maps * m_line_table
Definition physical-location-maker.h:55
Definition cfghooks.h:26