Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

idDecl.c File Reference

#include "lclintMacros.nf"
#include "basic.h"

Go to the source code of this file.

Functions

idDecl idDecl_create ( cstring s, qtype t)
void idDecl_free (idDecl t)
cstring idDecl_unparse (idDecl d)
cstring idDecl_observeId (idDecl d)
qtype idDecl_getTyp (idDecl d)
ctype idDecl_getCtype (idDecl d)
qualList idDecl_getQuals (idDecl d)
void idDecl_addQual (idDecl d, qual q)
void idDecl_setTyp (idDecl d, qtype c)
idDecl idDecl_replaceCtype ( idDecl d, ctype c)
idDecl idDecl_fixBase ( idDecl t, qtype b)
idDecl idDecl_fixParamBase ( idDecl t, qtype b)
idDecl idDecl_expectFunction ( idDecl d)


Function Documentation

void idDecl_addQual ( idDecl d,
qual q )
 

Definition at line 114 of file idDecl.c.

00115 {
00116   llassert (idDecl_isDefined (d));
00117 
00118   (void) qtype_addQual (d->typ, q);
00119 }

idDecl idDecl_create ( cstring s,
qtype t )
 

Definition at line 32 of file idDecl.c.

Referenced by exprNode_initMod().

00033 {
00034   idDecl d = (idDecl) dmalloc (sizeof (*d));
00035 
00036   d->id = s;
00037   d->typ = t;
00038 
00039   return (d);
00040 }

idDecl idDecl_expectFunction ( idDecl d )
 

Definition at line 175 of file idDecl.c.

00176 {
00177   llassert (idDecl_isDefined (d));
00178 
00179   qtype_setType (d->typ, ctype_expectFunction (qtype_getType (d->typ)));
00180   return d;
00181 }

idDecl idDecl_fixBase ( idDecl t,
qtype b )
 

Definition at line 140 of file idDecl.c.

Referenced by checkConstant(), checkValueConstant(), fixUentryList(), and processNamedDecl().

00141 {
00142   llassert (idDecl_isDefined (t));
00143 
00144   t->typ = qtype_newQbase (t->typ, b);
00145   return t;
00146 }

idDecl idDecl_fixParamBase ( idDecl t,
qtype b )
 

Definition at line 149 of file idDecl.c.

00150 {
00151   qtype q;
00152   ctype c;
00153 
00154   llassert (idDecl_isDefined (t));
00155 
00156   q = qtype_newQbase (t->typ, b);
00157   c = qtype_getType (q);
00158 
00159   /*
00160   ** For some reason, C adds an implicit pointer to function
00161   ** parameters.  It is "optional" syntax.
00162   */
00163 
00164   if (ctype_isFunction (c) && !ctype_isPointer (c))
00165     {
00166       qtype_setType (q, ctype_makePointer (c));
00167     }
00168 
00169   t->typ = q;
00170   /* LCLint thinks t->typ is kept. */
00171   /*@-compmempass@*/ return t; /*@=compmempass@*/
00172 }

void idDecl_free ( idDecl t )
 

Definition at line 43 of file idDecl.c.

Referenced by declareFunction(), declareStaticFunction(), exprNode_initMod(), and idDeclList_free().

00044 {
00045   if (idDecl_isDefined (t))
00046     {
00047       cstring_free (t->id);
00048       qtype_free (t->typ);
00049       sfree (t);
00050     }
00051 }

ctype idDecl_getCtype ( idDecl d )
 

Definition at line 88 of file idDecl.c.

Referenced by declareStaticFunction(), processNamedDecl(), uentry_makeIdConstant(), uentry_makeIdDatatype(), uentry_makeIdFunction(), uentry_makeIdVariable(), and uentry_makeParam().

00089 {
00090   if (idDecl_isDefined (d))
00091     {
00092       return (qtype_getType (d->typ));
00093     }
00094   else
00095     {
00096       return ctype_unknown;
00097     }
00098 }

qualList idDecl_getQuals ( idDecl d )
 

Definition at line 101 of file idDecl.c.

00102 {
00103   if (idDecl_isDefined (d))
00104     {
00105       return (qtype_getQuals (d->typ));
00106     }
00107   else
00108     {
00109       return qualList_undefined;
00110     }
00111 }

qtype idDecl_getTyp ( idDecl d )
 

Definition at line 80 of file idDecl.c.

00081 {
00082   llassert (idDecl_isDefined (d));
00083 
00084   return d->typ;
00085 }

cstring idDecl_observeId ( idDecl d )
 

Definition at line 67 of file idDecl.c.

00068 {
00069   if (idDecl_isDefined (d))
00070     {
00071       return (d->id);
00072     }
00073   else
00074     {
00075       return cstring_undefined;
00076     }
00077 }

idDecl idDecl_replaceCtype ( idDecl d,
ctype c )
 

Definition at line 131 of file idDecl.c.

00132 {
00133   llassert (idDecl_isDefined (d));
00134 
00135   qtype_setType (d->typ, c);
00136   return d;
00137 }

void idDecl_setTyp ( idDecl d,
qtype c )
 

Definition at line 122 of file idDecl.c.

Referenced by exprNode_initMod().

00123 {
00124   llassert (idDecl_isDefined (d));
00125 
00126   qtype_free (d->typ);
00127   d->typ = c;
00128 }

cstring idDecl_unparse ( idDecl d )
 

Definition at line 54 of file idDecl.c.

00055 {
00056   if (idDecl_isDefined (d))
00057     {
00058       return (message ("%s : %q", d->id, qtype_unparse (d->typ)));
00059     }
00060   else
00061     {
00062       return (cstring_makeLiteral ("<undefined id>"));
00063     }
00064 }


Generated at Fri Nov 3 18:57:59 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000