d: Add test for PR d/108167 to the testsuite [PR108167]
[official-gcc.git] / gcc / analyzer / call-details.h
blob14a206ff5d67d924ae8266af3718e5bd1a05c878
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>.
5 This file is part of GCC.
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.
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.
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/>. */
21 #ifndef GCC_ANALYZER_CALL_DETAILS_H
22 #define GCC_ANALYZER_CALL_DETAILS_H
24 namespace ana {
26 /* Helper class for handling calls to functions with known behavior. */
28 class call_details
30 public:
31 call_details (const gcall *call, region_model *model,
32 region_model_context *ctxt);
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;
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; }
43 bool maybe_set_lhs (const svalue *result) const;
45 unsigned num_args () const;
46 bool arg_is_pointer_p (unsigned idx) const
48 return POINTER_TYPE_P (get_arg_type (idx));
50 bool arg_is_size_p (unsigned idx) const;
52 const gcall *get_call_stmt () const { return m_call; }
53 location_t get_location () const;
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;
60 tree get_fndecl_for_call () const;
62 void dump_to_pp (pretty_printer *pp, bool simple) const;
63 void dump (bool simple) const;
65 const svalue *get_or_create_conjured_svalue (const region *) const;
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;
75 } // namespace ana
77 #endif /* GCC_ANALYZER_CALL_DETAILS_H */