c++: new-expression is potentially constant in C++20
[official-gcc.git] / gcc / tree-nested.h
blobbb44b11a2fd15d38bb36cca6e6893730e934a468
1 /* Header file for Nested function decomposition for GIMPLE.
2 Copyright (C) 2013-2022 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_TREE_NESTED_H
21 #define GCC_TREE_NESTED_H
23 extern tree build_addr (tree);
24 extern void insert_field_into_struct (tree, tree);
25 extern void lower_nested_functions (tree);
27 class nested_function_info
29 public:
30 /* Constructor. */
31 nested_function_info ()
32 : origin (NULL),
33 nested (NULL),
34 next_nested (NULL)
37 /* Copy constructor. We can not simply copy the structure,
38 because the linked lists would go wrong. However we should never
39 need that. */
40 nested_function_info (const nested_function_info &)
42 gcc_unreachable ();
44 ~nested_function_info ();
46 /* Return nested_function_info, if available. */
47 static nested_function_info *get (cgraph_node *node);
49 /* Return nested_function_info possibly creating new one. */
50 static nested_function_info *get_create (cgraph_node *node);
52 /* Release all nested_function_infos. */
53 static void release (void);
55 /* For nested functions points to function the node is nested in. */
56 cgraph_node *origin;
57 /* Points to first nested function, if any. */
58 cgraph_node *nested;
59 /* Pointer to the next function with same origin, if any. */
60 cgraph_node *next_nested;
63 extern void maybe_record_nested_function (cgraph_node *node);
64 extern void unnest_function (cgraph_node *node);
66 /* If there are functions nested in NODE, return first one. */
67 inline cgraph_node *
68 first_nested_function (cgraph_node *node)
70 nested_function_info *info = nested_function_info::get (node);
71 return info ? info->nested : NULL;
74 /* Return next nested function (used to iterate from first_nested_function). */
75 inline cgraph_node *
76 next_nested_function (cgraph_node *node)
78 return nested_function_info::get (node)->next_nested;
81 /* Return origin of nested function (and NULL otherwise). */
82 inline cgraph_node *
83 nested_function_origin (cgraph_node *node)
85 nested_function_info *info = nested_function_info::get (node);
86 return info ? info->origin : NULL;
89 #endif /* GCC_TREE_NESTED_H */