+/* Add to class *CLS information for the declaration of variable or
+ type *ID. If *CLS is null, this means a global declaration. SC is
+ the storage class of *ID. FLAGS is a bit set giving additional
+ information about the member (see the F_* defines). */
+
+void
+add_declarator (cls, id, flags, sc)
+ struct sym **cls;
+ char **id;
+ int flags, sc;
+{
+ if (LOOKING_AT2 (';', ','))
+ {
+ /* The end of a member variable or of an access declaration
+ `X::f'. To distinguish between them we have to know whether
+ type information has been seen. */
+ if (*id)
+ {
+ char *regexp = matching_regexp ();
+ int pos = BUFFER_POS ();
+
+ if (*cls)
+ add_member_defn (*cls, *id, regexp, pos, 0, 1, SC_UNKNOWN, flags);
+ else
+ add_global_defn (*id, regexp, pos, 0, 1, sc, flags);
+ }
+
+ MATCH ();
+ print_info ();
+ }
+ else if (LOOKING_AT ('{'))
+ {
+ if (sc == SC_TYPE && *id)
+ {
+ /* A named enumeration. */
+ char *regexp = matching_regexp ();
+ int pos = BUFFER_POS ();
+ add_global_defn (*id, regexp, pos, 0, 1, sc, flags);
+ }
+
+ skip_matching ();
+ print_info ();
+ }
+
+ xfree (*id);
+ *id = NULL;
+ *cls = NULL;
+}