annotate gcc/gcc-rich-location.h @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Declarations relating to class gcc_rich_location
kono
parents:
diff changeset
2 Copyright (C) 2014-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_RICH_LOCATION_H
kono
parents:
diff changeset
21 #define GCC_RICH_LOCATION_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* A gcc_rich_location is libcpp's rich_location with additional
kono
parents:
diff changeset
24 helper methods for working with gcc's types. */
kono
parents:
diff changeset
25 class gcc_rich_location : public rich_location
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 public:
kono
parents:
diff changeset
28 /* Constructors. */
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 /* Constructing from a location. */
kono
parents:
diff changeset
31 gcc_rich_location (source_location loc) :
kono
parents:
diff changeset
32 rich_location (line_table, loc) {}
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* Methods for adding ranges via gcc entities. */
kono
parents:
diff changeset
35 void
kono
parents:
diff changeset
36 add_expr (tree expr);
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 void
kono
parents:
diff changeset
39 maybe_add_expr (tree t);
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 void add_fixit_misspelled_id (location_t misspelled_token_loc,
kono
parents:
diff changeset
42 tree hint_id);
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 /* If LOC is within the spans of lines that will already be printed for
kono
parents:
diff changeset
45 this gcc_rich_location, then add it as a secondary location
kono
parents:
diff changeset
46 and return true.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 Otherwise return false.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 This allows for a diagnostic to compactly print secondary locations
kono
parents:
diff changeset
51 in one diagnostic when these are near enough the primary locations for
kono
parents:
diff changeset
52 diagnostics-show-locus.c to cope with them, and to fall back to
kono
parents:
diff changeset
53 printing them via a note otherwise e.g.:
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 gcc_rich_location richloc (primary_loc);
kono
parents:
diff changeset
56 bool added secondary = richloc.add_location_if_nearby (secondary_loc);
kono
parents:
diff changeset
57 error_at_rich_loc (&richloc, "main message");
kono
parents:
diff changeset
58 if (!added secondary)
kono
parents:
diff changeset
59 inform (secondary_loc, "message for secondary");
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 Implemented in diagnostic-show-locus.c. */
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 bool add_location_if_nearby (location_t loc);
kono
parents:
diff changeset
64 };
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 #endif /* GCC_RICH_LOCATION_H */