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