CodeSonar C++ API
[For improved navigation, enable JavaScript.]
cs_edge_label.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023, an unpublished work by CodeSecure, Inc.
3  * ALL RIGHTS RESERVED
4  *
5  * Copyright (c) 2013-2023, an unpublished work by GrammaTech, Inc.
6  * ALL RIGHTS RESERVED
7  *
8  * This software is furnished under a license and may be used and
9  * copied only in accordance with the terms of such license and the
10  * inclusion of the above copyright notice. This software or any
11  * other copies thereof may not be provided or otherwise made
12  * available to any other person. Title to and ownership of the
13  * software is retained by CodeSecure, Inc.
14  */
15 
16 #ifndef CS_EDGE_LABEL_HPP
17 #define CS_EDGE_LABEL_HPP
18 
19 #include "cs_edge_label.h"
20 #include "cs_types_common.h"
21 #include "cs_ir_boilerplate.hpp"
22 #include "cs_scratchpad.hpp"
23 
26 #ifndef CSFE_API
27 #include "cs_types.hpp"
28 #endif /* CSFE_API */
29 
30 namespace cs{
31 #ifndef CSFE_API
32  CS_IR_BOILERPLATE_FORWARD(
33  edge_label,
34  cs_edge_label,
35  friend class cglue<basic_block_cfg_edge>;
36  friend class cglue<cfg_edge>;
37  friend class cglue<cfg_path_node>;
38  friend class ir_factory;
39  friend class step_state;
41  friend struct FatTypeTraits<edge_label>;
43  friend class cfg_path_node;
44  );
45 #else /* CSFE_API */
46  CS_IR_BOILERPLATE_FORWARD(
47  edge_label,
48  cs_edge_label,
49  friend class csfe::ir_factory;
50  friend class csfe::point;
51  );
52 #endif /* CSFE_API */
53 
57  class edge_label{
64  CS_IR_BOILERPLATE(edge_label);
65 
71  edge_label(bool val)
72  : inner(val?cs_edge_label_true():cs_edge_label_false()){}
73 
74 
79  std::string name() const
80  {
81  string_scratchpad::
82  to_string_functor1_limit<edge_label, cs_edge_label_get_string>
83  functor(inner, -1);
84  return string_scratchpad::to_string(functor);
85  }
86 
88  std::string as_string() const
89  { return name(); }
90 
92  std::string as_repr() const
93  { return CS_AS_REPR_FROM_STRING(edge_label); }
94  };
95  CS_IR_BOILERPLATE_FRIENDS_PLUS_OSTREAM(edge_label, cs)
96 
97  inline edge_label cglue<edge_label>::wrap(const cs_edge_label &c)
98  { return edge_label(c); }
99 
100  inline cs_edge_label cglue<edge_label>::unwrap(const edge_label &c)
101  { return c.unwrap(); }
102 }
103 
104 #endif /* CS_EDGE_LABEL_HPP */
Denotes the conditions under which control can flow along an edge: a component of a cfg_edge...
Definition: cs_edge_label.hpp:57
Namespace for CodeSonar/CodeSurfer API.
Definition: cs_ast.hpp:33
std::pair< cs::point, cs::edge_label > cfg_edge
A std::pair (p, el) where:
Definition: cs_tplt_instantiations.hpp:130
std::string name() const
Get the string representation of an edge_label.
Definition: cs_edge_label.hpp:79
std::string as_string() const
Get a simple string representation of a edge_label object.
Definition: cs_edge_label.hpp:90
std::string as_repr() const
Get a representation of a edge_label object that includes information useful for debugging.
Definition: cs_edge_label.hpp:97
edge_label(bool val)
Constructor for a boolean edge_label.
Definition: cs_edge_label.hpp:71