CodeSonar C++ API
[For improved navigation, enable JavaScript.]
cs_xr_kind_role.hpp
Go to the documentation of this file.
1 #ifndef CS_XR_KIND_ROLE_HPP
2 #define CS_XR_KIND_ROLE_HPP
3 
5 #include "cs_xref_common.h"
6 
9 namespace cs {
10 
20  inline csuint64 xr_namehash(const std::string &s)
21  { return cs_xref_namehash_unterminated(s.c_str(), s.size()); }
22 
23 
31  class xr_kind{
32  CS_ENUM_BOILERPLATE_UB(xr_kind, cs_xr_kind,
33  rv = cs_xr_kind_name(inner),
34  csxrk_count);
35 #include "cs_xr_kind_decls.hpp"
36  };
37  CS_ENUM_BOILERPLATE_FRIENDS(xr_kind,
38  friend class xr_kind_role;
39  friend class xr_query_iterator_policy_container;,
40  cs
41  )
42 #include "cs_xr_kind_defs.hpp"
43 
48  class xr_role{
49  CS_ENUM_BOILERPLATE_UB(xr_role, cs_xr_role,
50  rv = cs_xr_role_name(inner),
51  csxrr_count);
52 #include "cs_xr_role_decls.hpp"
53  };
54  CS_ENUM_BOILERPLATE_FRIENDS(xr_role,
55  friend class xr_kind_role;
56  friend class xr_query_iterator_policy_container;,
57  cs
58  )
59 #include "cs_xr_role_defs.hpp"
60 
67  class xr_kind_role{
68  CS_ENUM_BOILERPLATE_UB(xr_kind_role, cs_xr_kind_role,
69  rv = cs_xr_kind_role_name(inner),
70  csxrkr_count);
71 
81  {
83  && k == xr_kind::BUILTIN )
84  {
85  check(CS_ERROR_INVALID_ARGUMENT);
86  }
87  inner = cs_xr_kind_role_compose(
88  cglue<xr_kind>::unwrap(k), cglue<xr_role>::unwrap(r));
89  if( inner >= csxrkr_count )
90  check(CS_ERROR_INVALID_ARGUMENT);
91  }
92 
100 #ifdef CSFE_API
101  csfe::
102 #endif /* CSFE_API */
103  xr_kind_role_pair decompose() const
104  {
105  cs_xr_kind rv1;
106  cs_xr_role rv2;
107  cs_xr_kind_role_decompose(inner, &rv1, &rv2);
108  return std::pair<xr_kind, xr_role>(xr_kind::,
109  xr_role::);
110  }
111 #include "cs_xr_kind_role_decls.hpp"
112  };
113 #ifndef CSFE_API
114  CS_ENUM_BOILERPLATE_FRIENDS(xr_kind_role,
115  friend class xr_tuple;
116  friend class sfile;
117  friend class xr_query_iterator_policy_container;
118  friend class cglue<xr_tuple>;,
119  cs
120  )
121 #else /* CSFE_API */
122  CS_ENUM_BOILERPLATE_FRIENDS(xr_kind_role,
123  friend class xr_tuple;
124  friend class sfile;
125  friend class csfe::ir_factory;,
127  )
128 #endif /* CSFE_API */
129 #include "cs_xr_kind_role_defs.hpp"
130 
131 }
132 
133 #endif /* CS_XR_KIND_ROLE_HPP */
std::pair< cs::xr_kind, cs::xr_role > xr_kind_role_pair
A std::pair (k, r) where:
Definition: cs_tplt_instantiations.hpp:378
Namespace for CodeSonar/CodeSurfer API.
Definition: cs_ast.hpp:33
csuint64 xr_namehash(const std::string &s)
Hash a token name.
Definition: cs_xr_kind_role.hpp:20
Describes an occurrence of a token in a particular kind-role and the definition corresponding to that...
Definition: cs_xref.hpp:35
static const xr_kind BUILTIN
[C++ / GNU C only] builtin: the name of a __builtin_*() function.
Definition: cs_xr_kind_role.hpp:102
static const xr_role DEFINITION
...when defined.
Definition: cs_xr_kind_role.hpp:42
A source file.
Definition: cs_sfile_decl.hpp:98
Enumeration class: describes the kind of a (non-keyword) token.
Definition: cs_xr_kind_role.hpp:31
Enumeration class: describes the role that a token is playing at a particular occurrence of that toke...
Definition: cs_xr_kind_role.hpp:48
Enumeration class: describes a valid token kind-role (kind-usage) pair.
Definition: cs_xr_kind_role.hpp:67