Predator  [unstable] git snapshot
symid.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Kamil Dudka <kdudka@redhat.com>
3  *
4  * This file is part of predator.
5  *
6  * predator is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * any later version.
10  *
11  * predator is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with predator. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef H_GUARD_SYM_ID_H
21 #define H_GUARD_SYM_ID_H
22 
23 /**
24  * @file symid.hh
25  * types used for identification of SymHeap entities - symid.hh::TFldId and
26  * symid.hh::TValId
27  */
28 
29 #include "config.h"
30 
31 #include <climits> // needed for UINT_MAX
32 #include <utility> // needed for std::pair
33 
34 /**
35  * SymHeap @b field @b ID
36  * @note Though the type is defined as enumeration for now, the code should not
37  * rely on that fact, as it may be subject for change in the future.
38  */
39 enum TFldId {
40  /**
41  * special enumeration value denoting a failure of a method which may return
42  * a valid object. FLD_INVALID can @b never denote a valid object. @n @n
43  */
45 
46  /**
47  * special enumeration value denoting a result of invalid dereference,
48  * either direct or implied. FLD_DEREF_FAILED can @b never denote a valid
49  * object. This enumeration value is used for sort of error recovery,
50  * especially to avoid flood of error messages triggered by a single error
51  * in the analyzed program. @n @n
52  */
54 
55  /**
56  * special enumeration value denoting we in fact @b know @b nothing about
57  * the requested object. FLD_UNKNOWN may or may not stand for an existing
58  * object. @n @n
59  */
61 
62  /**
63  * sort of non-portable hack, abusing enumeration type for integral purposes
64  */
65  FLD_MAX_ID = /* XXX */ UINT_MAX
66 };
67 
68 /**
69  * SymHeap @b value @b ID
70  * @note Though the type is defined as enumeration for now, the code should not
71  * rely on that fact, as it may be subject for change in the future.
72  */
73 enum TValId {
74  /**
75  * special enumeration value denoting a NULL pointer. This value can't be
76  * followed by SymHeap::pointsTo(). This enumeration value @b coincides
77  * with @b VAL_FALSE and can't be anyhow distinguished without the owning
78  * object. @n @n
79  */
80  VAL_NULL = 0,
81 
82  /**
83  * special enumeration value denoting a failure of a method which may return
84  * a value ID. VAL_INVALID can @b never denote a valid value. @n @n
85  */
87 
88  /**
89  * special enumeration value denoting a Boolean false value. This
90  * enumeration value @b coincides with @b VAL_NULL and can't be anyhow
91  * distinguished without the owning object. @n @n
92  */
94 
95  /**
96  * special enumeration value denoting a Boolean true value or (int) 1.
97  */
98  VAL_TRUE = 1,
99 
100  /**
101  * @copydoc symid.hh::FLD_MAX_ID
102  */
103  VAL_MAX_ID = /* XXX */ UINT_MAX
104 };
105 
106 typedef std::pair<TValId, TValId> TValPair;
107 
108 /**
109  * SymHeap @b object @b ID
110  * @note Though the type is defined as enumeration for now, the code should not
111  * rely on that fact, as it may be subject for change in the future.
112  */
113 enum TObjId {
114  /// for signalling error states only
116 
117  /// target of VAL_NULL (a.k.a. NULL object)
119 
120  /// return value of the function currently being executed
122 
123  /// @copydoc symid.hh::FLD_MAX_ID
124  OBJ_MAX_ID = /* XXX */ UINT_MAX
125 };
126 
127 typedef std::pair<TObjId, TObjId> TObjPair;
128 
129 #endif /* H_GUARD_SYM_ID_H */