summaryrefslogtreecommitdiff
path: root/gcc/types-inlines.h
blob: 40ff45c491b14336aa5b1fbb8e450af79f081d27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once



inline void
log(const char* const fmt, ...)
{
  if (!dump_file) return;
  
  va_list args;
  va_start(args, fmt);
  vfprintf(dump_file, fmt, args);
  fflush(dump_file);
  va_end(args);
}

inline void
is_gimple_code(gimple *stmt, const enum gimple_code ex_code)
{
  gcc_assert(stmt);
  const enum gimple_code ob_code = gimple_code(stmt);
  const bool succeeds = ex_code == ob_code;
  gcc_assert(succeeds);
}

inline void
assert_is_complete(const_tree a)
{
  gcc_assert(a);
  const_tree type_size = TYPE_SIZE(a);
  gcc_assert(NULL_TREE != type_size);
}

inline bool
is_complete(const_tree a)
{
  gcc_assert(a);
  const_tree type_size = TYPE_SIZE(a);
  const bool _is_complete = NULL_TREE != type_size;
  return _is_complete;
}

inline void
assert_is_type(const_tree a, const enum tree_code expected_code)
{
  gcc_assert(a);
  const enum tree_code observed_code = TREE_CODE(a);
  const bool eq_codes = observed_code == expected_code;
  gcc_assert(eq_codes);
}

inline void
assert_is_complete_type(const_tree a, const enum tree_code expected_code)
{
  //assert_is_complete(a);
  assert_is_type(a, expected_code);
}

inline void
is_gimple_rhs_class(gimple *stmt, const enum gimple_rhs_class ex_class)
{
  gcc_assert(stmt);
  is_gimple_code(stmt, GIMPLE_ASSIGN);
  const enum gimple_rhs_class ob_class = gimple_assign_rhs_class(stmt);
  const bool succeeds = ex_class == ob_class;
  gcc_assert(succeeds);
}