Skip to content

Commit 5dbc81e

Browse files
author
Daniel Marjamäki
committed
myplugin1: better handling of function calls
1 parent a2444c7 commit 5dbc81e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

myplugin1/myplugin1.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ static void print_expr(tree t, int indent)
2222

2323
code = TREE_CODE(t);
2424

25+
// Declarations..
2526
if (code == RESULT_DECL ||
2627
code == PARM_DECL ||
2728
code == LABEL_DECL ||
28-
code == VAR_DECL) {
29+
code == VAR_DECL ||
30+
code == FUNCTION_DECL) {
2931

3032
// this tree node points at a DECL_NAME node
3133
tree id = DECL_NAME(t);
@@ -74,7 +76,8 @@ static void print_expr(tree t, int indent)
7476
code != LABEL_EXPR &&
7577
code != GOTO_EXPR &&
7678
code != NOP_EXPR &&
77-
code != DECL_EXPR)
79+
code != DECL_EXPR &&
80+
code != ADDR_EXPR)
7881
print_expr(TREE_OPERAND(t, 1), indent + 2);
7982
}
8083

myplugin1/test1.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
int f(unsigned char c) {
3+
int x;
4+
x = c + c;
5+
}
6+
27
int sqr(int x) {
3-
return x*x;
8+
return x * x;
49
}

0 commit comments

Comments
 (0)