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