]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/analyzer/call-details.h
Update copyright years.
[thirdparty/gcc.git] / gcc / analyzer / call-details.h
1 /* Helper class for handling a call with specific arguments.
2 Copyright (C) 2019-2023 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21 #ifndef GCC_ANALYZER_CALL_DETAILS_H
22 #define GCC_ANALYZER_CALL_DETAILS_H
23
24 namespace ana {
25
26 /* Helper class for handling calls to functions with known behavior. */
27
28 class call_details
29 {
30 public:
31 call_details (const gcall *call, region_model *model,
32 region_model_context *ctxt);
33
34 region_model *get_model () const { return m_model; }
35 region_model_manager *get_manager () const;
36 region_model_context *get_ctxt () const { return m_ctxt; }
37 logger *get_logger () const;
38
39 uncertainty_t *get_uncertainty () const;
40 tree get_lhs_type () const { return m_lhs_type; }
41 const region *get_lhs_region () const { return m_lhs_region; }
42
43 bool maybe_set_lhs (const svalue *result) const;
44
45 unsigned num_args () const;
46 bool arg_is_pointer_p (unsigned idx) const
47 {
48 return POINTER_TYPE_P (get_arg_type (idx));
49 }
50 bool arg_is_size_p (unsigned idx) const;
51
52 const gcall *get_call_stmt () const { return m_call; }
53 location_t get_location () const;
54
55 tree get_arg_tree (unsigned idx) const;
56 tree get_arg_type (unsigned idx) const;
57 const svalue *get_arg_svalue (unsigned idx) const;
58 const char *get_arg_string_literal (unsigned idx) const;
59
60 tree get_fndecl_for_call () const;
61
62 void dump_to_pp (pretty_printer *pp, bool simple) const;
63 void dump (bool simple) const;
64
65 const svalue *get_or_create_conjured_svalue (const region *) const;
66
67 private:
68 const gcall *m_call;
69 region_model *m_model;
70 region_model_context *m_ctxt;
71 tree m_lhs_type;
72 const region *m_lhs_region;
73 };
74
75 } // namespace ana
76
77 #endif /* GCC_ANALYZER_CALL_DETAILS_H */