- DITypeRef getClassType() const {
- return cast<MDDerivedType>(get())->getClassType();
- }
-
- Constant *getConstant() const {
- return cast<MDDerivedType>(get())->getConstant();
- }
-};
-
-/// \brief Types that refer to multiple other types.
-///
-/// This descriptor holds a type that can refer to multiple other types, like a
-/// function or struct.
-///
-/// DICompositeType is derived from DIDerivedType because some
-/// composite types (such as enums) can be derived from basic types
-// FIXME: Make this derive from DIType directly & just store the
-// base type in a single DIType field.
-class DICompositeType : public DIDerivedType {
- friend class DIBuilder;
-
-public:
- DICompositeType() = default;
- DICompositeType(const MDCompositeTypeBase *N) : DIDerivedType(N) {}
-
- MDCompositeTypeBase *get() const {
- return cast_or_null<MDCompositeTypeBase>(DIDescriptor::get());
- }
- operator MDCompositeTypeBase *() const { return get(); }
- MDCompositeTypeBase *operator->() const { return get(); }
- MDCompositeTypeBase &operator*() const { return *get(); }
-
- DIArray getElements() const { return get()->getElements(); }
-
- unsigned getRunTimeLang() const { return get()->getRuntimeLang(); }
- DITypeRef getContainingType() const { return get()->getVTableHolder(); }
-
- DIArray getTemplateParams() const { return get()->getTemplateParams(); }
- MDString *getIdentifier() const { return get()->getRawIdentifier(); }
-};
-
-class DISubroutineType : public DICompositeType {
-public:
- DISubroutineType() = default;
- DISubroutineType(const MDSubroutineType *N) : DICompositeType(N) {}
-
- MDSubroutineType *get() const {
- return cast_or_null<MDSubroutineType>(DIDescriptor::get());
- }
- operator MDSubroutineType *() const { return get(); }
- MDSubroutineType *operator->() const { return get(); }
- MDSubroutineType &operator*() const { return *get(); }
-
- MDTypeRefArray getTypeArray() const { return get()->getTypeArray(); }
-};
-
-/// \brief This is a wrapper for a file.
-class DIFile : public DIScope {