113
172
CObjectInfo *_TypedefInfo;
116
CTypeInfo (CTypeInfo *, TypeId);
176
* \param base The base type of a compound type.
177
* \param id The type ID. */
178
CTypeInfo (CTypeInfo *base, TypeId id);
119
bool operator ==(const CTypeInfo &) const;
120
bool operator !=(const CTypeInfo &) const;
182
/** Check if this type equals the given type.
183
* \param type The type to compare with. */
184
bool operator ==(const CTypeInfo &type) const;
185
/** Check if this type not equals the given type.
186
* \param type The type to compare with. */
187
bool operator !=(const CTypeInfo &type) const;
189
/** Print the textual representation of this
190
* type on the given stream.
191
* \param os The output stream. */
122
192
void print (ostream& os) const;
123
void TypeText (ostream &, const char *name = (const char*)0,
193
/** Print the textual representation of this
194
* type on the given stream.
195
* \param os The output stream.
196
* \param name Optional name of the entity to print.
197
* \param abs Print qualified names with root qualifier.
198
* \param tdef Print the name of a typedef instead of the underlying type.
199
* \param elaborated_type_spec Print elaborated type specifier before
200
* class, union, and enumeration types. */
201
void TypeText (ostream &os, const char *name = (const char*)0,
124
202
bool abs = false, bool tdef = false,
125
203
bool elaborated_type_spec = false) const;
205
/** Get the dimension of an array type. */
126
206
long int Dimension () const;
207
/** Get the size in bits of a type. */
128
208
long int Size () const;
209
/** Get the alignment of a type. */
129
210
long int Align () const;
212
/** Get the type identifier. */
131
213
TypeId Id () const;
215
/** Get the base type of a compound type.
216
* \return The base type or this if not a compound type. */
133
217
CTypeInfo *BaseType () const;
134
void BaseType (CTypeInfo *);
218
/** Set the base type of a compount type.
219
* \param base The base type. */
220
void BaseType (CTypeInfo *base);
222
/** Check if this is a typedef type. */
136
223
bool isTypedef () const;
224
/** Get the typedef information if this is a typedef type. */
137
225
CObjectInfo *TypedefInfo () const;
226
/** Set the typedef information if this is a typedef type. */
138
227
CTypeInfo *TypedefInfo (CObjectInfo *);
140
bool isComplete (unsigned long = 0) const;
229
/** Check if this is a complete type. Optionally limited to
230
* a specific source code position. A type is complete
231
* if it is not undefined, not void, not an fixed length
232
* array without dimension, and not a class or enumeration
233
* that is only declared but not defined.
234
* \param pos Optional source code position. */
235
bool isComplete (unsigned long pos = 0) const;
237
/** Check if this type or one of its base types depends on
238
* a template parameter.
239
* \param consider_unknown_t Consider unknown_t as dependent. */
240
bool isDependent (bool consider_unknown_t = true) const;
242
/** Check if this type is \e const qualified. */
141
243
bool isConst () const;
244
/** Check if this type is \e volatile qualified. */
142
245
bool isVolatile () const;
246
/** Check if this type is \e restrict qualified. */
143
247
bool isRestrict () const;
144
bool isDependent (bool = true) const;
249
/** Get the class or union of a class or union type.
250
* \return The class or union, or NULL if not such a type. */
146
251
CRecord *Record () const;
252
/** Get the class information if this is a class type.
253
* \return The class information or NULL if not a class type. */
147
254
CClassInfo *ClassInfo () const;
255
/** Get the union information if this is a union type.
256
* \return The union information or NULL if not a union type. */
148
257
CUnionInfo *UnionInfo () const;
258
/** Get the enumeration information if this is an enumeration type.
259
* \return The enumeration information or NULL if not an enumeration type. */
149
260
CEnumInfo *EnumInfo () const;
261
/** Get the function information if this is a function type.
262
* \return The function information or NULL if not a function type. */
150
263
CFunctionInfo *FunctionInfo () const;
265
/** Get the base type of a pointer type. */
152
266
CTypeInfo *PtrBaseType () const;
267
/** Get the argument type list of a function or qualified type. */
153
268
CTypeList *ArgTypes () const;
269
/** Get the virtual type of this type. If this type is a qualified,
270
* bit-field, or reference type then the virtual type is the
271
* virtual type of the base type of this type.
272
* \return The base type or this. */
154
273
CTypeInfo *VirtualType () const;
274
/** Get the unqualified version of this type.
275
* \return The unqualified type or this if not qualified. */
155
276
CTypeInfo *UnqualType () const;
278
/** Get the function type of a pointer-to-function type.
279
* \return The function type or NULL if not a pointer to function. */
157
280
CTypeFunction *PtrToFct () const;
281
/** Get the array type of a pointer-to-array type.
282
* \return The array type or NULL if not a pointer to array. */
158
283
CTypeArray *PtrToArray () const;
285
/** Get the pointer to CTypeQualified if this is a qualified type.
286
* \return The valid pointer or NULL. */
160
287
CTypeQualified *TypeQualified () const;
288
/** Get the pointer to CTypeFunction if this is a function type.
289
* \return The valid pointer or NULL. */
161
290
CTypeFunction *TypeFunction () const;
291
/** Get the pointer to CTypeBitField if this is a bit-field type.
292
* \return The valid pointer or NULL. */
162
293
CTypeBitField *TypeBitField () const;
294
/** Get the pointer to CTypePointer if this is a pointer type.
295
* \return The valid pointer or NULL. */
163
296
CTypePointer *TypePointer () const;
297
/** Get the pointer to CTypeMemberPointer if this is a member pointer type.
298
* \return The valid pointer or NULL. */
164
299
CTypeMemberPointer *TypeMemberPointer () const;
300
/** Get the pointer to CTypeAddress if this is a reference type.
301
* \return The valid pointer or NULL. */
165
302
CTypeAddress *TypeAddress () const;
303
/** Get the pointer to CTypeArray if this is an array type.
304
* \return The valid pointer or NULL. */
166
305
CTypeArray *TypeArray () const;
306
/** Get the pointer to CTypeVarArray if this is a variable length array type.
307
* \return The valid pointer or NULL. */
167
308
CTypeVarArray *TypeVarArray () const;
309
/** Get the pointer to CTypeClass if this is a class type.
310
* \return The valid pointer or NULL. */
168
311
CTypeClass *TypeClass () const;
312
/** Get the pointer to CTypeUnion if this is a union type.
313
* \return The valid pointer or NULL. */
169
314
CTypeUnion *TypeUnion () const;
315
/** Get the pointer to CTypeRecord if this is a class or union type.
316
* \return The valid pointer or NULL. */
170
317
CTypeRecord *TypeRecord () const;
318
/** Get the pointer to CTypeEnum if this is an enumeration type.
319
* \return The valid pointer or NULL. */
171
320
CTypeEnum *TypeEnum () const;
321
/** Get the pointer to CTypePrimitive if this is a primitive type.
322
* \return The valid pointer or NULL. */
172
323
CTypePrimitive *TypePrimitive () const;
324
/** Get the pointer to CTypeInfo if this is type Puma::CTYPE_EMPTY.
325
* \return The valid pointer or NULL. */
173
326
CTypeInfo *TypeEmpty () const;
327
/** Get the pointer to CTypeTemplateParam if this is a template parameter type.
328
* \return The valid pointer or NULL. */
174
329
CTypeTemplateParam *TypeTemplateParam () const;
331
/** Check if this is a qualified type. */
176
332
bool isQualified () const;
333
/** Check if this is a pointer type. */
177
334
bool isPointer () const;
335
/** Check if this is a pointer or array type. */
178
336
bool isPointerOrArray () const;
337
/** Check if this is a reference type. */
179
338
bool isAddress () const;
339
/** Check if this is a class or union type. */
180
340
bool isRecord () const;
341
/** Check if this is a class type. */
181
342
bool isClass () const;
343
/** Check if this is a union type. */
182
344
bool isUnion () const;
345
/** Check if this is an array type. */
183
346
bool isArray () const;
347
/** Check if this is a fixed length array type. */
184
348
bool isFixedArray () const;
349
/** Check if this is a variable length type. */
185
350
bool isVarArray () const;
351
/** Check if this is an arithmetic type. */
186
352
bool isArithmetic () const;
353
/** Check if this is a pointer or arithmetic type. */
187
354
bool isScalar () const;
355
/** Check if this is an array, class, or union type. */
188
356
bool isAggregate () const;
357
/** Check if this is an integer type. */
189
358
bool isInteger () const;
359
/** Check if this is type \e void. */
190
360
bool isVoid () const;
361
/** Check if this is an enumeration type. */
191
362
bool isEnum () const;
363
/** Check if this is a floating point type. */
192
364
bool isReal () const;
365
/** Check if this is a member pointer type. */
193
366
bool isMemberPointer () const;
367
/** Check if this is an undefined type. */
194
368
bool isUndefined () const;
369
/** Check if this is a function type. */
195
370
bool isFunction () const;
371
/** Check if this is a bit-field type. */
196
372
bool isBitField () const;
373
/** Check if this is a class member function type. */
197
374
bool isMethod () const;
375
/** Check if this is a non-class-member function type. */
198
376
bool isStdFunction () const;
377
/** Check if this is a template type. */
199
378
bool isTemplate () const;
379
/** Check if this is a template instance type. */
200
380
bool isTemplateInstance () const;
381
/** Check if this is a template parameter type. */
201
382
bool isTemplateParam () const;
383
/** Check if this is a type template parameter type. */
202
384
bool isTypeParam () const;
385
/** Check if this is a non-type template parameter type. */
203
386
bool isNonTypeParam () const;
204
bool isObject (unsigned long = 0) const;
387
/** Check if this is an object type. An object type is a
388
* complete non-function type.
389
* \param pos Optional source code position. */
390
bool isObject (unsigned long pos = 0) const;
206
392
// Primitive types.
393
/** Check if the ID of this type is CTypeInfo::TYPE_BOOL. */
207
394
bool is_bool () const;
395
/** Check if the ID of this type is CTypeInfo::TYPE_CHAR. */
208
396
bool is_char () const;
397
/** Check if the ID of this type is CTypeInfo::TYPE_WCHAR_T. */
209
398
bool is_wchar_t () const;
399
/** Check if the ID of this type is CTypeInfo::TYPE_SHORT. */
210
400
bool is_short () const;
401
/** Check if the ID of this type is CTypeInfo::TYPE_INT. */
211
402
bool is_int () const;
403
/** Check if the ID of this type is CTypeInfo::TYPE_LONG. */
212
404
bool is_long () const;
405
/** Check if the ID of this type is CTypeInfo::TYPE_LONG_LONG. */
213
406
bool is_long_long () const;
407
/** Check if the ID of this type is CTypeInfo::TYPE_SIGNED_CHAR. */
214
408
bool is_signed_char () const;
409
/** Check if the ID of this type is CTypeInfo::TYPE_UNSIGNED_CHAR. */
215
410
bool is_unsigned_char () const;
411
/** Check if the ID of this type is CTypeInfo::TYPE_UNSIGNED_SHORT. */
216
412
bool is_unsigned_short () const;
413
/** Check if the ID of this type is CTypeInfo::TYPE_UNSIGNED_INT. */
217
414
bool is_unsigned_int () const;
415
/** Check if the ID of this type is CTypeInfo::TYPE_UNSIGNED_LONG. */
218
416
bool is_unsigned_long () const;
417
/** Check if the ID of this type is CTypeInfo::TYPE_UNSIGNED_LONG_LONG. */
219
418
bool is_unsigned_long_long () const;
419
/** Check if the ID of this type is CTypeInfo::TYPE_FLOAT. */
220
420
bool is_float () const;
421
/** Check if the ID of this type is CTypeInfo::TYPE_DOUBLE. */
221
422
bool is_double () const;
423
/** Check if the ID of this type is CTypeInfo::TYPE_LONG_DOUBLE. */
222
424
bool is_long_double () const;
425
/** Check if the ID of this type is CTypeInfo::TYPE_VOID. */
223
426
bool is_void () const;
427
/** Check if the ID of this type is CTypeInfo::TYPE_UNDEFINED. */
224
428
bool is_undefined () const;
429
/** Check if the ID of this type is CTypeInfo::TYPE_UNKNOWN_T. */
225
430
bool is_unknown_t () const;
431
/** Check if the ID of this type is CTypeInfo::TYPE_ELLIPSIS. */
226
432
bool is_ellipsis () const;
434
/** Check if this is a signed integer type. */
228
435
bool is_signed () const;
436
/** Check if this is an unsigned integer type. */
229
437
bool is_unsigned () const;
231
// arithmetic conversion rank (C only)
439
/** Get the arithmetic conversion rank of the type.
440
* \note Language C only! */
232
441
unsigned conv_rank () const;
233
// compare arithmetic types (C only)
234
bool operator >(const CTypeInfo &) const;
235
bool operator >=(const CTypeInfo &) const;
236
bool operator <=(const CTypeInfo &) const;
237
bool operator <(const CTypeInfo &) const;
442
/** Check if the conversion rank of this type is greater
443
* than the conversion rank of the given type.
444
* \note Language C only!
445
* \param type The type to compare with. */
446
bool operator >(const CTypeInfo &type) const;
447
/** Check if the conversion rank of this type equals or
448
* is greater than the conversion rank of the given type.
449
* \note Language C only!
450
* \param type The type to compare with. */
451
bool operator >=(const CTypeInfo &type) const;
452
/** Check if the conversion rank of this type equals or
453
* is greater than the conversion rank of the given type.
454
* \note Language C only!
455
* \param type The type to compare with. */
456
bool operator <=(const CTypeInfo &type) const;
457
/** Check if the conversion rank of this type is less
458
* than the conversion rank of the given type.
459
* \note Language C only!
460
* \param type The type to compare with. */
461
bool operator <(const CTypeInfo &type) const;
239
// rank C++ arithmetic types
463
/** Get the rank of this type if it is an arithmetic type.
464
* \note Language C++ only!
465
* \return The rank or 0 if not an arithmetic type. */
240
466
unsigned rank () const;
243
// Duplicate the given type structure.
244
#ifndef __puma // PUMA is confused by static and non-static declaration
247
CTypeInfo *Duplicate (const CTypeInfo *);
469
/** Make a duplicate of the given type.
470
* \param type The type to duplicate. */
471
static CTypeInfo *Duplicate (const CTypeInfo *type);
472
/** Maka a duplicate of this type. */
249
473
CTypeInfo *Duplicate () const;
251
// Destroy the given type structure.
252
static void Destroy (CTypeInfo *);
475
/** Destroy the given type.
476
* \param type The type to destroy. */
477
static void Destroy (CTypeInfo *type);
254
void Mangled (ostream &) const;
479
/** Print the mangled textual representation of
480
* the type on the given stream. According to the
481
* C++ V3 ABI mangling (see http://www.codesourcery.com/cxx-abi/abi.html).
482
* \param os The output stream. */
483
void Mangled (ostream &os) const;
257
486
bool equalTemplateParams (CTemplateParamInfo *p1, CTemplateParamInfo *p2) const;