Polly
20.0.0git
llvm-project
polly
lib
External
isl
isl_ast_node_set_field_templ.c
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Ecole Normale Superieure
3
*
4
* Use of this software is governed by the MIT license
5
*
6
* Written by Sven Verdoolaege,
7
* Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8
*/
9
10
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
11
#define FN(TYPE,NAME) xFN(TYPE,NAME)
12
13
/* Replace the field FIELD of "node" by "field",
14
* where the field may or may not have already been set in "node".
15
* However, if the field has not already been set,
16
* then "node" is required to have a single reference.
17
* In this case the call to isl_ast_node_cow has no effect.
18
*/
19
__isl_give
isl_ast_node
*
FN
(
FN
(
FN
(
isl_ast_node
,
NODE_TYPE
),
set
),
FIELD_NAME
)(
20
__isl_take
isl_ast_node
*node,
__isl_take
FIELD_TYPE
*field)
21
{
22
if
(
FN
(isl_ast_node_check,
NODE_TYPE
)(node) < 0 || !field)
23
goto
error;
24
if
(node->FIELD == field) {
25
FN
(
FIELD_TYPE
,free)(field);
26
return
node;
27
}
28
29
node =
isl_ast_node_cow
(node);
30
if
(!node)
31
goto
error;
32
33
FN
(
FIELD_TYPE
,free)(node->FIELD);
34
node->FIELD = field;
35
36
return
node;
37
error:
38
isl_ast_node_free
(node);
39
FN
(
FIELD_TYPE
,free)(field);
40
return
NULL;
41
}
isl_ast_node_free
__isl_null isl_ast_node * isl_ast_node_free(__isl_take isl_ast_node *node)
Definition:
isl_ast.c:1180
__isl_take
#define __isl_take
Definition:
ctx.h:22
__isl_give
#define __isl_give
Definition:
ctx.h:19
FIELD_NAME
#define FIELD_NAME
Definition:
isl_ast.c:1720
isl_ast_node_cow
__isl_give isl_ast_node * isl_ast_node_cow(__isl_take isl_ast_node *node)
Definition:
isl_ast.c:1169
FIELD_TYPE
#define FIELD_TYPE
Definition:
isl_ast.c:1722
NODE_TYPE
#define NODE_TYPE
Definition:
isl_ast.c:1718
FN
#define FN(TYPE, NAME)
Definition:
isl_ast_node_set_field_templ.c:11
set
const char * set
Definition:
isl_test.c:1356
isl_ast_node
Definition:
isl_ast_private.h:58
Generated on Wed Nov 13 2024 03:17:21 for Polly by
1.9.6