]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/analyzer/call-info.h
Use "final" and "override" directly, rather than via macros
[thirdparty/gcc.git] / gcc / analyzer / call-info.h
CommitLineData
eafa9d96 1/* Subclasses of custom_edge_info for describing outcomes of function calls.
7adcbafe 2 Copyright (C) 2021-2022 Free Software Foundation, Inc.
eafa9d96
DM
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_ANALYZER_CALL_INFO_H
22#define GCC_ANALYZER_CALL_INFO_H
23
24namespace ana {
25
26/* Subclass of custom_edge_info for an outcome of a call.
27 This is still abstract; the update_model and get_desc vfuncs must be
28 implemented. */
29
30class call_info : public custom_edge_info
31{
32public:
ff171cb1 33 void print (pretty_printer *pp) const final override;
eafa9d96 34 void add_events_to_path (checker_path *emission_path,
ff171cb1 35 const exploded_edge &eedge) const final override;
eafa9d96
DM
36
37 const gcall *get_call_stmt () const { return m_call_stmt; }
38 tree get_fndecl () const { return m_fndecl; }
39
40 virtual label_text get_desc (bool can_colorize) const = 0;
41
42 call_details get_call_details (region_model *model,
43 region_model_context *ctxt) const;
44
45protected:
46 call_info (const call_details &cd);
47
48private:
49 const gcall *m_call_stmt;
50 tree m_fndecl;
51};
52
53/* Subclass of call_info for a "success" outcome of a call,
54 adding a "when `FNDECL' succeeds" message.
55 This is still abstract: the custom_edge_info::update_model vfunc
56 must be implemented. */
57
58class success_call_info : public call_info
59{
60public:
ff171cb1 61 label_text get_desc (bool can_colorize) const final override;
eafa9d96
DM
62
63protected:
64 success_call_info (const call_details &cd) : call_info (cd) {}
65};
66
67/* Subclass of call_info for a "failure" outcome of a call,
68 adding a "when `FNDECL' fails" message.
69 This is still abstract: the custom_edge_info::update_model vfunc
70 must be implemented. */
71
72class failed_call_info : public call_info
73{
74public:
ff171cb1 75 label_text get_desc (bool can_colorize) const final override;
eafa9d96
DM
76
77protected:
78 failed_call_info (const call_details &cd) : call_info (cd) {}
79};
80
81} // namespace ana
82
83#endif /* GCC_ANALYZER_CALL_INFO_H */