]> andersk Git - splint.git/blame - src/Headers/sRef.h
Changed checking of complete descruction so +strictdestroy is no
[splint.git] / src / Headers / sRef.h
CommitLineData
885824d3 1/*
28bf4b0b 2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
885824d3 3** See ../LICENSE for license information.
4**
5*/
6/*
7** storeRef.h
8*/
9
10# ifndef STOREREF_H
11# define STOREREF_H
12
13/*
14** note: forwardTypes defines sRef
15*/
16
17/*
18** kinds of storage references
19*/
20
21typedef enum {
22 SR_NOTHING,
23 SR_INTERNAL,
24 SR_SPECSTATE,
28bf4b0b 25 SR_SYSTEM,
26 SR_GLOBALMARKER
885824d3 27} speckind;
28
29typedef enum {
30 SK_PARAM,
31 SK_ARRAYFETCH,
32 SK_FIELD,
33 SK_PTR,
34 SK_ADR,
35 SK_CONST,
36 SK_CVAR,
37 SK_UNCONSTRAINED,
38 SK_OBJECT,
39 SK_CONJ,
40 SK_EXTERNAL,
41 SK_DERIVED,
42 SK_NEW,
43 SK_TYPE,
44 SK_RESULT,
45 SK_SPECIAL,
46 SK_UNKNOWN
47} skind;
48
28bf4b0b 49typedef struct
885824d3 50{
51 int lexlevel;
52 usymId index;
53} *cref;
54
28bf4b0b 55typedef struct
885824d3 56{
57 /*@exposed@*/ /*@notnull@*/ sRef arr;
58 bool indknown;
59 int ind;
60} *ainfo;
61
28bf4b0b 62typedef struct
885824d3 63{
64 /*@exposed@*/ /*@notnull@*/ sRef rec;
65 /*@observer@*/ cstring field;
66} *fldinfo ;
67
28bf4b0b 68typedef struct
885824d3 69{
70 /*@exposed@*/ /*@notnull@*/ sRef a;
71 /*@exposed@*/ /*@notnull@*/ sRef b;
72} *cjinfo ;
73
28bf4b0b 74typedef union
885824d3 75{
76 /*@only@*/ cref cvar;
77 int paramno;
78 /*@only@*/ ainfo arrayfetch;
28bf4b0b 79 /*@only@*/ fldinfo field;
885824d3 80 ctype object;
81 /*@observer@*/ cstring fname; /* unconstrained, new */
b9904f57 82 /*@exposed@*/ /*@notnull@*/ sRef ref;
885824d3 83 /*@only@*/ cjinfo conj;
84 speckind spec;
85} *sinfo;
86
28bf4b0b 87struct s_sRef
885824d3 88{
89 /* does it need to be inside parens (macros) */
28bf4b0b 90 bool safe;
885824d3 91
92 /* has it been modified */
28bf4b0b 93 bool modified; /* BOOLBITS; */
94
95 /* for debugging: make this sRef as immutable. */
96 bool immut; /* BOOLBITS; */
885824d3 97
98 skind kind;
99 ctype type;
100
b9904f57 101 multiVal val; /* Some sRef's have known values */
102
885824d3 103 sstate defstate;
104 nstate nullstate;
105
1ac6313d 106 /* start modifications: We keep a track of the buf state(nullterm info)*/
28bf4b0b 107 struct s_bbufinfo bufinfo;
1ac6313d 108 /* end modifications */
109
885824d3 110 alkind aliaskind;
111 alkind oaliaskind;
112
113 exkind expkind; /* exposed, observer, normal */
114 exkind oexpkind;
115
116 /* where it becomes observer/exposed */
28bf4b0b 117 /*@null@*/ /*@only@*/ stateInfo expinfo;
885824d3 118
119 /* where it changed alias kind */
28bf4b0b 120 /*@null@*/ /*@only@*/ stateInfo aliasinfo;
885824d3 121
122 /* where it is defined/allocated */
28bf4b0b 123 /*@null@*/ /*@only@*/ stateInfo definfo;
885824d3 124
28bf4b0b 125 /* where it is null */
126 /*@null@*/ /*@only@*/ stateInfo nullinfo;
885824d3 127
128 /*@only@*/ /*@relnull@*/ sinfo info;
129
130 /* stores fields for structs, elements for arrays, derefs for pointers */
131 /*@only@*/ sRefSet deriv;
28bf4b0b 132
133 /* sRef's include a lookup table of state variables. */
134 /*@only@*/ valueTable state;
885824d3 135} ;
136
137extern bool sRef_perhapsNull (sRef p_s);
138extern bool sRef_possiblyNull (sRef p_s);
139extern bool sRef_definitelyNull (sRef p_s);
140
28bf4b0b 141extern bool sRef_definitelyNullContext (sRef p_s);
142extern bool sRef_definitelyNullAltContext (sRef p_s);
143
885824d3 144extern void sRef_setNullError (sRef p_s);
145extern void sRef_setNullUnknown (sRef p_s, fileloc p_loc);
146extern void sRef_setNotNull (sRef p_s, fileloc p_loc);
147extern void sRef_setNullState (sRef p_s, nstate p_n, fileloc p_loc);
28bf4b0b 148extern void sRef_setNullStateN (sRef p_s, nstate p_n);
885824d3 149extern void sRef_setNullStateInnerComplete (sRef p_s, nstate p_n, fileloc p_loc);
150extern void sRef_setPosNull (sRef p_s, fileloc p_loc);
151extern void sRef_setDefNull (sRef p_s, fileloc p_loc);
152
153extern /*@truenull@*/ bool sRef_isInvalid (sRef p_s) /*@*/ ;
154extern /*@falsenull@*/ bool sRef_isValid (sRef p_s) /*@*/ ;
155
156/*@constant null sRef sRef_undefined; @*/
157# define sRef_undefined ((sRef) NULL)
158# define sRef_isInvalid(s) ((s) == NULL)
159# define sRef_isValid(s) ((s) != NULL)
160
161extern bool sRef_isRecursiveField (sRef p_s) /*@*/ ;
162extern void sRef_copyRealDerivedComplete (sRef p_s1, sRef p_s2) /*@modifies p_s1@*/ ;
163extern nstate sRef_getNullState (/*@sef@*/ sRef p_s) /*@*/ ;
164extern bool sRef_isNotNull (sRef p_s) /*@*/ ;
165
885824d3 166extern bool sRef_isDefinitelyNull (sRef p_s) /*@*/ ;
167
168extern /*@falsenull@*/ bool sRef_isLocalVar (sRef p_s) /*@*/ ;
169extern /*@falsenull@*/ bool sRef_isNSLocalVar (sRef p_s) /*@*/ ;
170extern /*@falsenull@*/ bool sRef_isRealLocalVar (sRef p_s) /*@*/ ;
171extern /*@falsenull@*/ bool sRef_isLocalParamVar (sRef p_s) /*@*/ ;
172extern /*@falsenull@*/ bool sRef_isKnown (/*@sef@*/ sRef p_s) /*@*/ ;
173
174extern bool sRef_hasLastReference (sRef p_s) /*@*/ ;
175# define sRef_hasLastReference(s) (sRef_hasAliasInfoRef (s))
176
177# define sRef_isKnown(s) (sRef_isValid(s) && (s)->kind != SK_UNKNOWN)
178
179extern bool sRef_isMeaningful (/*@sef@*/ sRef p_s) /*@*/ ;
180# define sRef_isMeaningful(s) (sRef_isValid(s) && sRef_isKnown(s) \
181 && (s)->kind != SK_NEW && (s)->kind != SK_TYPE)
182extern bool sRef_isNew (/*@sef@*/ sRef p_s) /*@*/ ;
183# define sRef_isNew(s) (sRef_isValid(s) && (s)->kind == SK_NEW)
184
185extern bool sRef_isType (/*@sef@*/ sRef p_s) /*@*/ ;
186# define sRef_isType(s) (sRef_isValid(s) && (s)->kind == SK_TYPE)
187
188extern bool sRef_isSafe (/*@sef@*/ sRef p_s) /*@*/ ;
189# define sRef_isSafe(s) (sRef_isValid(s) && (s)->safe)
190
191extern bool sRef_isUnsafe (/*@sef@*/ sRef p_s) /*@*/ ;
192# define sRef_isUnsafe(s) (sRef_isValid(s) && !(s)->safe)
193
194extern void sRef_clearAliasKind (/*@sef@*/ sRef p_s) /*@modifies p_s@*/ ;
195# define sRef_clearAliasKind(s) (sRef_isValid(s) ? (s)->aliaskind = AK_UNKNOWN : AK_ERROR)
196
197extern bool sRef_stateKnown (/*@sef@*/ sRef p_s) /*@*/ ;
198# define sRef_stateKnown(s) (sRef_isValid(s) && (s)->defstate != SS_UNKNOWN)
199
200extern alkind sRef_getAliasKind (/*@sef@*/ sRef p_s) /*@*/ ;
885824d3 201
202extern alkind sRef_getOrigAliasKind (/*@sef@*/ sRef p_s) /*@*/ ;
203# define sRef_getOrigAliasKind(s) (sRef_isValid(s) ? (s)->oaliaskind : AK_ERROR)
204
205extern /*@falsenull@*/ bool sRef_isConj (/*@sef@*/ sRef p_s) /*@*/ ;
206# define sRef_isConj(s) (sRef_isValid(s) && (s)->kind == SK_CONJ)
207
208extern /*@exposed@*/ sRef sRef_buildArrow (sRef p_s, /*@dependent@*/ cstring p_f);
209extern /*@exposed@*/ sRef sRef_makeArrow (sRef p_s, /*@dependent@*/ cstring p_f);
210
211extern bool sRef_isAllocIndexRef (sRef p_s) /*@*/ ;
212extern void sRef_setAliasKind (sRef p_s, alkind p_kind, fileloc p_loc) /*@modifies p_s@*/ ;
213extern void sRef_setPdefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
214
215extern /*@unused@*/ bool sRef_hasDerived (sRef p_s) /*@*/ ;
216extern void sRef_clearDerived (sRef p_s);
217extern void sRef_clearDerivedComplete (sRef p_s);
218extern /*@exposed@*/ sRef sRef_getBaseSafe (sRef p_s);
219
28bf4b0b 220extern /*@observer@*/ sRefSet sRef_derivedFields (/*@temp@*/ sRef p_rec) /*@*/ ;
885824d3 221extern bool sRef_sameName (sRef p_s1, sRef p_s2) /*@*/ ;
222extern bool sRef_isDirectParam (sRef p_s) /*@*/ ;
223extern /*@exposed@*/ sRef sRef_makeAnyArrayFetch (/*@exposed@*/ sRef p_arr);
224extern bool sRef_isUnknownArrayFetch (sRef p_s) /*@*/ ;
225
226extern void sRef_setPartialDefinedComplete (sRef p_s, fileloc p_loc);
227extern bool sRef_isMacroParamRef (sRef p_s) /*@*/ ;
228
229extern void sRef_destroyMod (void) /*@modifies internalState@*/ ;
230
231extern bool sRef_deepPred (bool (p_predf) (sRef), sRef p_s);
232
233extern bool sRef_aliasCompleteSimplePred (bool (p_predf) (sRef), sRef p_s);
234
235extern void sRef_clearExKindComplete (sRef p_s, fileloc p_loc);
236
237extern /*@falsenull@*/ bool sRef_isKindSpecial (/*@sef@*/ sRef p_s) /*@*/ ;
238# define sRef_isKindSpecial(s) (sRef_isValid (s) && (s)->kind == SK_SPECIAL)
239
240extern /*@observer@*/ cstring sRef_nullMessage (sRef p_s) /*@*/ ;
241
242extern bool sRef_isSystemState (sRef p_s) /*@*/ ;
28bf4b0b 243extern bool sRef_isGlobalMarker (sRef p_s) /*@*/ ;
885824d3 244extern bool sRef_isInternalState (sRef p_s) /*@*/ ;
245extern bool sRef_isResult (sRef p_s) /*@*/ ;
246extern bool sRef_isSpecInternalState (sRef p_s) /*@*/ ;
247extern bool sRef_isSpecState (sRef p_s) /*@*/ ;
248extern bool sRef_isNothing (sRef p_s) /*@*/ ;
249
28bf4b0b 250extern bool sRef_isFileOrGlobalScope (sRef p_s) /*@*/ ;
885824d3 251extern bool sRef_isReference (sRef p_s) /*@*/ ;
252
253extern ctype sRef_deriveType (sRef p_s, uentryList p_cl) /*@*/ ;
254extern ctype sRef_getType (sRef p_s) /*@*/ ;
255
28bf4b0b 256extern void sRef_markImmutable (sRef p_s) /*@modifies p_s@*/ ;
257
885824d3 258extern /*@falsenull@*/ bool sRef_isAddress (sRef p_s) /*@*/ ;
259extern /*@falsenull@*/ bool sRef_isArrayFetch (sRef p_s) /*@*/ ;
260extern /*@falsenull@*/ bool sRef_isConst (sRef p_s) /*@*/ ;
261extern /*@falsenull@*/ bool sRef_isCvar (sRef p_s) /*@*/ ;
262extern /*@falsenull@*/ bool sRef_isField (sRef p_s) /*@*/ ;
263extern /*@falsenull@*/ bool sRef_isParam (sRef p_s) /*@*/ ;
264extern /*@falsenull@*/ bool sRef_isPointer (sRef p_s) /*@*/ ;
265
266extern void sRef_setType (sRef p_s, ctype p_t);
267extern void sRef_setTypeFull (sRef p_s, ctype p_t);
268extern void sRef_mergeNullState (sRef p_s, nstate p_n);
28bf4b0b 269extern void sRef_setLastReference (/*@temp@*/ sRef p_s, /*@exposed@*/ sRef p_ref, fileloc p_loc);
885824d3 270extern bool sRef_canModify (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/ ;
271extern bool sRef_canModifyVal (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/ ;
272extern bool sRef_isIReference (sRef p_s) /*@*/ ;
273extern bool sRef_isIndexKnown (sRef p_arr) /*@*/ ;
274extern bool sRef_isModified (sRef p_s) /*@*/ ;
275
276extern bool sRef_isExternallyVisible (sRef p_s) /*@*/ ;
277extern int sRef_compare (sRef p_s1, sRef p_s2) /*@*/ ;
278extern bool sRef_realSame (sRef p_s1, sRef p_s2) /*@*/ ;
28bf4b0b 279extern bool sRef_sameObject (sRef p_s1, sRef p_s2) /*@*/ ;
885824d3 280extern bool sRef_same (sRef p_s1, sRef p_s2) /*@*/ ;
281extern bool sRef_similar (sRef p_s1, sRef p_s2) /*@*/ ;
282extern /*@observer@*/ cstring sRef_getField (sRef p_s) /*@*/ ;
283extern /*@only@*/ cstring sRef_unparse (sRef p_s) /*@*/ ;
284extern /*@observer@*/ cstring sRef_stateVerb (sRef p_s) /*@*/ ;
285extern /*@observer@*/ cstring sRef_stateAltVerb (sRef p_s) /*@*/ ;
286extern /*@only@*/ cstring sRef_unparseOpt (sRef p_s) /*@*/ ;
287extern /*@only@*/ cstring sRef_unparseDebug (sRef p_s) /*@*/ ;
288extern void sRef_killComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
289extern int sRef_getIndex (sRef p_arr) /*@*/ ;
290extern /*@dependent@*/ sRef sRef_fixOuterRef (/*@returned@*/ sRef p_s);
2e127cb8 291
292/* Use this one to clear after error */
293extern void sRef_setDefinedCompleteDirect (sRef p_s, fileloc p_loc) ;
294
295extern void sRef_setDefinedComplete (sRef p_s, fileloc p_loc) ;
296extern void sRef_setDefinedNCComplete (sRef p_s, fileloc p_loc) ;
885824d3 297extern int sRef_getParam (sRef p_s) /*@*/ ;
298extern int sRef_lexLevel (sRef p_s) /*@*/ ;
299extern void sRef_setOrigAliasKind (sRef p_s, alkind p_kind);
28bf4b0b 300
885824d3 301extern /*@exposed@*/ sRef
3120b462 302 sRef_fixBase (/*@returned@*/ sRef p_s, /*@returned@*/ sRef p_base)
885824d3 303 /*@modifies p_s, p_base@*/ ;
304
305extern void sRef_showNotReallyDefined (sRef p_s) /*@modifies g_msgstream@*/ ;
306
28bf4b0b 307extern void sRef_enterFunctionScope (void) /*@modifies internalState@*/ ;
308extern void sRef_setGlobalScope (void) /*@modifies internalState@*/ ;
309extern bool sRef_inGlobalScope (void) /*@*/ ;
310extern void sRef_exitFunctionScope (void) /*@modifies internalState@*/ ;
311extern void sRef_clearGlobalScopeSafe (void) /*@modifies internalState@*/ ;
312extern void sRef_setGlobalScopeSafe (void) /*@modifies internalState@*/ ;
885824d3 313
314extern /*@notnull@*/ /*@exposed@*/ sRef
315 sRef_buildArrayFetch (/*@exposed@*/ sRef p_arr);
316extern /*@notnull@*/ /*@exposed@*/ sRef sRef_buildArrayFetchKnown (/*@exposed@*/ sRef p_arr, int p_i);
317extern /*@exposed@*/ sRef
28bf4b0b 318 sRef_buildField (/*@exposed@*/ sRef p_rec, /*@dependent@*/ cstring p_f)
885824d3 319 /*@modifies p_rec@*/ ;
320extern /*@exposed@*/ sRef sRef_buildPointer (/*@exposed@*/ sRef p_t)
321 /*@modifies p_t@*/ ;
322
323extern /*@exposed@*/ sRef sRef_makeAddress (/*@exposed@*/ sRef p_t);
324extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeUnconstrained (/*@exposed@*/ cstring) /*@*/ ;
325
326extern /*@falsenull@*/ bool sRef_isUnconstrained (sRef p_s) /*@*/ ;
327
328extern /*@observer@*/ cstring sRef_unconstrainedName (sRef p_s) /*@*/ ;
329
28bf4b0b 330extern /*@notnull@*/ /*@exposed@*/ sRef sRef_makeArrayFetch (/*@exposed@*/ sRef p_arr) /*@*/ ;
885824d3 331extern /*@notnull@*/ /*@exposed@*/ sRef
28bf4b0b 332 sRef_makeArrayFetchKnown (/*@exposed@*/ sRef p_arr, int p_i);
885824d3 333extern /*@notnull@*/ /*@dependent@*/ sRef
334 sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef p_a, /*@exposed@*/ sRef p_b);
335extern /*@notnull@*/ /*@dependent@*/ sRef
6970c11b 336 sRef_makeCvar (int p_level, usymId p_index, ctype p_ct, /*@only@*/ stateInfo p_stinfo);
885824d3 337extern /*@notnull@*/ /*@dependent@*/ sRef
338 sRef_makeConst (ctype p_ct);
339extern /*@exposed@*/ sRef
340 sRef_makeField (sRef p_rec, /*@dependent@*/ cstring p_f);
341extern /*@notnull@*/ /*@dependent@*/ sRef
6970c11b 342 sRef_makeGlobal (usymId p_l, ctype p_ct, /*@only@*/ stateInfo);
885824d3 343extern /*@exposed@*/ sRef
28bf4b0b 344 sRef_makeNCField (/*@exposed@*/ sRef p_rec, /*@dependent@*/ cstring p_f) /*@*/ ;
885824d3 345extern void sRef_maybeKill (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
346extern /*@unused@*/ /*@notnull@*/ /*@dependent@*/ sRef
347 sRef_makeObject (ctype p_o) /*@*/ ;
348extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeType (ctype p_ct) /*@*/ ;
6970c11b 349extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeParam (int p_l, ctype p_ct, /*@only@*/ stateInfo p_stinfo) /*@*/ ;
28bf4b0b 350extern /*@exposed@*/ sRef sRef_makePointer (/*@exposed@*/ sRef p_s) /*@modifies p_s@*/ ;
885824d3 351extern void sRef_makeSafe (sRef p_s) /*@modifies p_s@*/ ;
352extern void sRef_makeUnsafe (sRef p_s) /*@modifies p_s@*/ ;
885824d3 353
28bf4b0b 354extern /*@dependent@*/ sRef sRef_makeUnknown (void) /*@*/ ;
355extern /*@dependent@*/ sRef sRef_makeNothing (void) /*@*/ ;
356extern /*@dependent@*/ sRef sRef_makeInternalState (void) /*@*/ ;
357extern /*@dependent@*/ sRef sRef_makeSpecState (void) /*@*/ ;
358extern /*@dependent@*/ sRef sRef_makeGlobalMarker (void) /*@*/ ;
359extern /*@dependent@*/ sRef sRef_makeSystemState (void) /*@*/ ;
885824d3 360
b072092f 361extern /*@dependent@*/ /*@notnull@*/ sRef sRef_makeResult (ctype) /*@*/ ;
885824d3 362extern /*@exposed@*/ sRef
363 sRef_fixResultType (/*@returned@*/ sRef p_s, ctype p_typ, uentry p_ue)
364 /*@modifies p_s@*/;
365
366extern void sRef_setParamNo (sRef p_s, int p_l) /*@modifies p_s;@*/;
367
28bf4b0b 368extern /*@notnull@*/ /*@dependent@*/ sRef
369 sRef_makeNew (ctype p_ct, sRef p_t, /*@exposed@*/ cstring p_name) ;
885824d3 370
371extern usymId sRef_getScopeIndex (sRef p_s) /*@*/ ;
372extern /*@exposed@*/ uentry sRef_getBaseUentry (sRef p_s);
373
374extern /*@exposed@*/ sRef
375 sRef_fixBaseParam (/*@returned@*/ sRef p_s, exprNodeList p_args)
376 /*@modifies p_s@*/ ;
377
ef2aa32a 378 /*
379 drl7x
380 added function
381 12/24/2000
382 */
4ab867d6 383
28bf4b0b 384/*@only@*/ constraintExpr sRef_fixConstraintParam (/*@observer@*/ sRef p_s, /*@observer@*/ /*@temp@*/ exprNodeList p_args);
ef2aa32a 385
885824d3 386extern bool sRef_isUnionField (sRef p_s);
387extern void sRef_setModified (sRef p_s);
388
389extern void sRef_resetState (sRef p_s);
390extern void sRef_resetStateComplete (sRef p_s);
391
392extern void sRef_storeState (sRef p_s);
393extern /*@exposed@*/ sRef sRef_getBase (sRef p_s) /*@*/ ;
394extern /*@exposed@*/ sRef sRef_getRootBase (sRef p_s) /*@*/ ;
395
396extern /*@observer@*/ uentry sRef_getUentry (sRef p_s);
397
398extern cstring sRef_dump (sRef p_s) /*@*/ ;
399extern cstring sRef_dumpGlobal (sRef p_s) /*@*/ ;
400extern /*@exposed@*/ sRef sRef_undump (char **p_c) /*@modifies *p_c@*/ ;
401extern /*@exposed@*/ sRef sRef_undumpGlobal (char **p_c) /*@modifies *p_c@*/ ;
402
403extern /*@only@*/ sRef sRef_saveCopy (sRef p_s);
404extern /*@dependent@*/ sRef sRef_copy (sRef p_s);
405
406extern cstring sRef_unparseState (sRef p_s) /*@*/ ;
407extern ynm sRef_isWriteable (sRef p_s) /*@*/ ;
3e3ec469 408extern ynm sRef_isValidLvalue (sRef p_s) /*@*/ ;
885824d3 409extern bool sRef_isStrictReadable (sRef p_s) /*@*/ ;
410extern bool sRef_hasNoStorage (sRef p_s) /*@*/ ;
411extern void sRef_showExpInfo (sRef p_s) /*@modifies g_msgstream*/ ;
412extern void sRef_setDefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
413extern void sRef_setUndefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
414extern void sRef_setOnly (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
415extern void sRef_setDependent (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
416extern void sRef_setOwned (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
417extern void sRef_setKept (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
418extern void sRef_setKeptComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
419extern void sRef_setFresh (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
420extern void sRef_setShared (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
421extern void sRef_showAliasInfo (sRef p_s) /*@modifies g_msgstream@*/ ;
28bf4b0b 422extern void sRef_showMetaStateInfo (sRef p_s, cstring p_key) /*@modifies g_msgstream@*/ ;
885824d3 423extern void sRef_showNullInfo (sRef p_s) /*@modifies g_msgstream@*/ ;
424extern void sRef_showStateInfo (sRef p_s) /*@modifies g_msgstream@*/ ;
425extern void sRef_setStateFromType (sRef p_s, ctype p_ct) /*@modifies p_s@*/ ;
426extern void sRef_kill (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
427extern void sRef_setAllocated (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
428extern void sRef_setAllocatedShallowComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
429extern void sRef_setAllocatedComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
430extern /*@only@*/ cstring sRef_unparseKindNamePlain (sRef p_s) /*@*/ ;
431extern /*@falsenull@*/ bool sRef_isRealGlobal(sRef p_s) /*@*/ ;
432extern /*@falsenull@*/ bool sRef_isFileStatic (sRef p_s) /*@*/ ;
433
434extern int sRef_getScope (sRef p_s) /*@*/ ;
435extern /*@observer@*/ cstring sRef_getScopeName (sRef p_s) /*@*/ ;
436
437/* must be real function (passed as function param) */
438extern /*@falsenull@*/ bool sRef_isDead (sRef p_s) /*@*/ ;
439extern /*@falsenull@*/ bool sRef_isDeadStorage (sRef p_s) /*@*/ ;
440extern bool sRef_isStateLive (sRef p_s) /*@*/ ;
441extern /*@falsenull@*/ bool sRef_isPossiblyDead (sRef p_s) /*@*/ ;
442extern /*@truenull@*/ bool sRef_isStateUndefined (sRef p_s) /*@*/ ;
443extern bool sRef_isUnuseable (sRef p_s) /*@*/ ;
444
445extern /*@exposed@*/ sRef sRef_constructDeref (sRef p_t)
446 /*@modifies p_t@*/ ;
447
448extern /*@exposed@*/ sRef sRef_constructDeadDeref (sRef p_t)
449 /*@modifies p_t@*/ ;
450
451extern bool sRef_isJustAllocated (sRef p_s) /*@*/ ;
452
453extern /*@falsenull@*/ bool sRef_isAllocated (sRef p_s) /*@*/ ;
454
455extern bool sRef_isUndefGlob (/*@sef@*/ sRef p_s) /*@*/ ;
456# define sRef_isUndefGlob(s) \
457 ((sRef_isValid(s)) \
458 && ((s)->defstate == SS_UNDEFGLOB || (s)->defstate == SS_UNDEFKILLED))
459
460extern bool sRef_isKilledGlob (/*@sef@*/ sRef p_s) /*@*/ ;
461# define sRef_isKilledGlob(s) \
462 ((sRef_isValid(s)) \
463 && ((s)->defstate == SS_KILLED || (s)->defstate == SS_UNDEFKILLED))
464
465extern bool sRef_isRelDef (/*@sef@*/ sRef p_s) /*@*/ ;
466# define sRef_isRelDef(s) \
467 ((sRef_isValid(s)) && ((s)->defstate == SS_RELDEF))
468
469extern bool sRef_isPartial (/*@sef@*/ sRef p_s) /*@*/ ;
470# define sRef_isPartial(s) \
471 ((sRef_isValid(s)) && ((s)->defstate == SS_PARTIAL))
472
473extern bool sRef_isStateSpecial (/*@sef@*/ sRef p_s) /*@*/ ;
474# define sRef_isStateSpecial(s) \
475 ((sRef_isValid(s)) && ((s)->defstate == SS_SPECIAL))
476
28bf4b0b 477extern bool sRef_makeStateSpecial (sRef p_s)
478 /*@modifies p_s@*/
479 /* returns false is sRef already has an inconsistend defstate */ ;
480
885824d3 481extern bool sRef_isStateDefined (/*@sef@*/ sRef p_s) /*@*/ ;
482# define sRef_isStateDefined(s) \
483 ((sRef_isValid(s)) && (((s)->defstate == SS_DEFINED) \
484 || (s)->defstate == SS_RELDEF))
485
486extern bool sRef_isAnyDefined (/*@sef@*/ sRef p_s) /*@*/ ;
487# define sRef_isAnyDefined(s) ((sRef_isValid(s)) && \
488 (((s)->defstate == SS_DEFINED) \
489 || ((s)->defstate == SS_RELDEF) \
490 || ((s)->defstate == SS_PARTIAL)))
491
492extern /*@falsenull@*/ bool sRef_isPdefined (/*@sef@*/ sRef p_s) /*@*/ ;
493# define sRef_isPdefined(s) \
494 ((sRef_isValid(s)) && ((s)->defstate == SS_PDEFINED))
495
496extern bool sRef_isReallyDefined (sRef p_s) /*@*/ ;
497
498extern bool sRef_isStateUnknown (/*@sef@*/ sRef p_s) /*@*/ ;
499# define sRef_isStateUnknown(s) \
500 ((sRef_isValid(s)) && ((s)->defstate == SS_UNKNOWN))
501
502extern /*@falsenull@*/ bool sRef_isRefCounted (/*@sef@*/ sRef p_s) /*@*/ ;
503# define sRef_isRefCounted(s) \
504 ((sRef_isValid(s)) && ((s)->aliaskind == AK_REFCOUNTED))
505
506extern /*@falsenull@*/ bool sRef_isNewRef (/*@sef@*/ sRef p_s) /*@*/ ;
507# define sRef_isNewRef(s) \
508 ((sRef_isValid(s)) && ((s)->aliaskind == AK_NEWREF))
509
510extern /*@falsenull@*/ bool sRef_isKillRef (/*@sef@*/ sRef p_s) /*@*/ ;
511# define sRef_isKillRef(s) \
512 ((sRef_isValid(s)) && ((s)->aliaskind == AK_KILLREF))
513
514extern bool sRef_isOnly (sRef p_s) /*@*/ ;
515extern bool sRef_isDependent (sRef p_s) /*@*/ ;
516extern bool sRef_isOwned (/*@sef@*/ sRef p_s) /*@*/ ;
517extern bool sRef_isKeep (/*@sef@*/ sRef p_s) /*@*/ ;
518
519extern bool sRef_isKept (/*@sef@*/ sRef p_s) /*@*/ ;
520# define sRef_isKept(s) \
521 ((sRef_isValid(s)) && ((s)->aliaskind == AK_KEPT))
522
523extern /*@unused@*/ bool sRef_isTemp (sRef p_s) /*@*/ ;
524
525extern bool sRef_isStack (sRef p_s) /*@*/ ;
526extern bool sRef_isLocalState (sRef p_s) /*@*/ ;
527extern bool sRef_isUnique (sRef p_s) /*@*/ ;
528extern bool sRef_isShared (sRef p_s) /*@*/ ;
529extern bool sRef_isExposed (sRef p_s) /*@*/ ;
530extern bool sRef_isObserver (sRef p_s) /*@*/ ;
531extern bool sRef_isFresh (sRef p_s) /*@*/ ;
532
533extern bool sRef_isRefsField (/*@sef@*/ sRef p_s) /*@*/ ;
534# define sRef_isRefsField(s) \
535 ((sRef_isValid(s)) && ((s)->aliaskind == AK_REFS))
536
537extern void sRef_protectDerivs (void) /*@modifies internalState@*/ ;
538extern void sRef_clearProtectDerivs (void) /*@modifies internalState@*/ ;
539
540extern exkind sRef_getExKind (sRef p_s) /*@*/ ;
541extern exkind sRef_getOrigExKind (sRef p_s) /*@*/ ;
542extern void sRef_setExKind (sRef p_s, exkind p_exp, fileloc p_loc) /*@modifies p_s@*/ ;
543extern void sRef_setExposed (sRef p_s, fileloc p_loc) /*@modifies p_s@*/;
544
545extern bool sRef_isAnyParam (sRef p_s) /*@*/ ;
28bf4b0b 546extern /*@observer@*/ sRef sRef_getAliasInfoRef (/*@temp@*/ sRef p_s) /*@*/ ;
885824d3 547extern bool sRef_hasAliasInfoRef (sRef p_s) /*@*/ ;
548
28bf4b0b 549extern /*@exposed@*/ sRef sRef_constructPointer (/*@exposed@*/ sRef p_t) /*@modifies p_t*/ ;
885824d3 550extern bool sRef_isAliasCheckedGlobal (sRef p_s) /*@*/ ;
551extern bool sRef_includedBy (sRef p_small, sRef p_big) /*@*/ ;
552extern /*@dependent@*/ /*@exposed@*/ sRef sRef_makeExternal (/*@exposed@*/ sRef p_t) /*@*/ ;
553extern bool sRef_similarRelaxed (sRef p_s1, sRef p_s2) /*@*/ ;
554extern /*@only@*/ cstring sRef_unparseKindName (sRef p_s) /*@*/ ;
555extern void sRef_copyState (sRef p_s1, sRef p_s2) /*@modifies p_s1@*/ ;
556extern /*@unused@*/ bool sRef_isObject (sRef p_s) /*@*/ ;
557extern bool sRef_isNotUndefined (sRef p_s) /*@*/ ;
558extern bool sRef_isExternal (sRef p_s) /*@*/ ;
559extern cstring sRef_unparseDeep (sRef p_s) /*@*/ ;
560extern cstring sRef_unparseFull (sRef p_s) /*@*/ ;
561extern /*@observer@*/ cstring sRef_unparseScope (sRef p_s) /*@*/ ;
562extern void sRef_mergeState (sRef p_res, sRef p_other, clause p_cl, fileloc p_loc)
563 /*@modifies p_res, p_other@*/ ;
564extern void sRef_mergeOptState (sRef p_res, sRef p_other, clause p_cl, fileloc p_loc)
565 /*@modifies p_res, p_other@*/ ;
566extern void sRef_mergeStateQuiet (sRef p_res, sRef p_other)
567 /*@modifies p_res@*/ ;
28bf4b0b 568extern void sRef_mergeStateQuietReverse (/*@dependent@*/ sRef p_res, /*@dependent@*/ sRef p_other)
885824d3 569 /*@modifies p_res@*/ ;
570extern void sRef_setStateFromUentry (sRef p_s, uentry p_ue)
571 /*@modifies p_s@*/ ;
572extern bool sRef_isStackAllocated (sRef p_s) /*@*/ ;
573extern bool sRef_modInFunction (void) /*@*/ ;
574extern void sRef_clearAliasState (sRef p_s, fileloc p_loc)
575 /*@modifies p_s@*/ ;
576extern void sRef_setPartial (sRef p_s, fileloc p_loc)
577 /*@modifies p_s@*/ ;
578extern void sRef_setDerivNullState (sRef p_set, sRef p_guide, nstate p_ns)
579 /*@modifies p_set@*/ ;
580
581extern void sRef_clearGlobalScope (void) /*@modifies internalState@*/ ;
582
28bf4b0b 583extern /*@dependent@*/ sRef sRef_makeDerived (/*@exposed@*/ sRef p_t);
885824d3 584
585extern sstate sRef_getDefState (sRef p_s) /*@*/ ;
586extern void sRef_setDefState (sRef p_s, sstate p_defstate, fileloc p_loc);
587extern void sRef_showRefLost (sRef p_s);
588extern void sRef_showRefKilled (sRef p_s);
589extern /*@exposed@*/ sRef sRef_updateSref (sRef p_s);
590
28bf4b0b 591extern void sRef_reflectAnnotation (sRef p_s, annotationInfo p_a, fileloc p_loc);
592extern /*@observer@*/ valueTable sRef_getValueTable (sRef p_s) /*@*/ ;
593
885824d3 594extern void sRef_aliasCheckPred (bool (p_predf) (sRef, exprNode, sRef, exprNode),
595 /*@null@*/ bool (p_checkAliases) (sRef),
596 sRef p_s, exprNode p_e, exprNode p_err);
597extern bool sRef_aliasCheckSimplePred (sRefTest p_predf, sRef p_s);
598
599extern void sRef_showStateInconsistent (sRef p_s);
600
601extern void sRef_setDependentComplete (sRef p_s, fileloc p_loc);
602
603extern void sRef_setAliasKindComplete (sRef p_s, alkind p_kind, fileloc p_loc);
604
605extern bool sRef_isThroughArrayFetch (sRef p_s) /*@*/ ;
606
607extern /*@exposed@*/ /*@notnull@*/ sRef sRef_getConjA (sRef p_s) /*@*/ ;
608extern /*@exposed@*/ /*@notnull@*/ sRef sRef_getConjB (sRef p_s) /*@*/ ;
609
610extern /*@only@*/ cstring sRef_unparsePreOpt (sRef p_s) /*@*/ ;
611
612extern bool sRef_hasName (sRef p_s) /*@*/ ;
885824d3 613extern void sRef_free (/*@only@*/ sRef p_s);
885824d3 614extern void sRef_setObserver (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ;
615
1ac6313d 616/* start modifications */
617/* functions for making modification to null-term info */
28bf4b0b 618extern void sRef_setNullTerminatedStateInnerComplete(sRef p_s, struct s_bbufinfo p_b, fileloc p_loc);
619extern struct s_bbufinfo sRef_getNullTerminatedState(sRef p_s);
1ac6313d 620extern void sRef_setNullTerminatedState (sRef p_s);
621extern void sRef_setPossiblyNullTerminatedState (sRef p_s);
622extern void sRef_setNotNullTerminatedState (sRef p_s);
4cccc6ad 623extern void sRef_setSize(sRef p_s, int p_size);
624extern void sRef_setLen(sRef p_s, int p_len);
1ac6313d 625
626extern int sRef_getSize(sRef p_s);
84c9ffbf 627
628/*@-nullderef@*/
629
1ac6313d 630#define sRef_getSize(p_s) \
ef2aa32a 631 ((p_s)->bufinfo.size)
1ac6313d 632
633extern int sRef_getLen(sRef p_s);
634#define sRef_getLen(p_s) \
ef2aa32a 635 ((p_s)->bufinfo.len)
1ac6313d 636
28bf4b0b 637extern bool sRef_hasBufStateInfo(sRef p_s);
1ac6313d 638# define sRef_hasBufStateInfo(p_s) \
639 (sRef_isValid(p_s))
640
84c9ffbf 641extern bool sRef_isNullTerminated(/*@sef@*/sRef p_s);
1ac6313d 642# define sRef_isNullTerminated(p_s) \
84c9ffbf 643 ( sRef_hasBufStateInfo((p_s)) ? ((p_s)->bufinfo.bufstate \
1ac6313d 644 == BB_NULLTERMINATED) : FALSE)
645
84c9ffbf 646extern bool sRef_isPossiblyNullTerminated(/*@sef@*/sRef p_s);
1ac6313d 647# define sRef_isPossiblyNullTerminated(p_s) \
34f0c5e7 648 ( sRef_hasBufStateInfo((p_s)) ? ( (p_s)->bufinfo.bufstate \
1ac6313d 649 == BB_POSSIBLYNULLTERMINATED) : FALSE)
650
84c9ffbf 651extern bool sRef_isNotNullTerminated(/*@sef@*/sRef p_s);
1ac6313d 652# define sRef_isNotNullTerminated(p_s) \
84c9ffbf 653 ( sRef_hasBufStateInfo((p_s)) ? ((p_s)->bufinfo.bufstate \
1ac6313d 654 == BB_NOTNULLTERMINATED) : FALSE)
34f0c5e7 655
84c9ffbf 656/*@=nullderef@*/
657
658
34f0c5e7 659 /*drl7x 11/28/00*/
dc92450f 660extern bool sRef_isFixedArray (sRef p_s) /*@*/;
34f0c5e7 661
dc92450f 662extern long int sRef_getArraySize (sRef p_s) /*@*/;
34f0c5e7 663
4cccc6ad 664extern /*@observer@*/ cstring sRef_ntMessage (sRef p_s);
28bf4b0b 665extern void sRef_resetLen (sRef p_s) /*@modifies p_s@*/ ;
666
1ac6313d 667/* end modifications */
668
28bf4b0b 669extern void sRef_setMetaStateValueComplete (sRef p_s, cstring p_key, int p_value, fileloc p_loc)
670 /*@modifies p_s@*/ ;
671
672extern void sRef_setMetaStateValue (sRef p_s, cstring p_key, int p_value, fileloc p_loc)
673 /*@modifies p_s@*/ ;
674
675extern /*@observer@*/ stateValue sRef_getMetaStateValue (sRef p_s, cstring p_key) /*@*/ ;
676
677extern bool sRef_checkMetaStateValue (sRef p_s, cstring p_key, int p_value)
678 /*@modifies p_s@*/ ;
679
b9904f57 680extern void sRef_setValue (sRef p_s, /*@only@*/ multiVal p_val) /*@modifies p_s@*/ ;
681extern bool sRef_hasValue (sRef p_s) /*@*/ ;
682extern /*@observer@*/ multiVal sRef_getValue (sRef p_s) /*@*/ ;
683
28bf4b0b 684extern /*@mayexit@*/ void sRef_checkValid (/*@temp@*/ sRef p_s) /*@modifies stderr@*/ ;
2934b455 685
1d239d69 686extern void
687sRef_aliasSetComplete (void (p_predf) (sRef, fileloc), sRef p_s, fileloc p_loc)
688 /*@modifies p_s@*/ ;
689
690extern void
691sRef_aliasSetCompleteParam (void (p_predf) (sRef, int, fileloc), sRef p_s,
692 int p_kind, fileloc p_loc)
693 /*@modifies p_s@*/ ;
694
68de3f33 695extern void
696sRef_aliasSetCompleteAlkParam (void (p_predf) (sRef, alkind, fileloc), sRef p_s,
697 alkind p_kind, fileloc p_loc)
698 /*@modifies p_s@*/ ;
699
700
1d239d69 701
702
703
885824d3 704# else
705# error "Multiple include"
706# endif
707
708
709
710
711
712
713
714
715
716
717
718
719
This page took 0.196312 seconds and 5 git commands to generate.