Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/types/abstracttype.h
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 90 | public: | |||
---|---|---|---|---|---|
94 | * An enumeration of common modifiers for data types. | 94 | * An enumeration of common modifiers for data types. | ||
95 | * If you have any language-specific modifiers that don't belong here, | 95 | * If you have any language-specific modifiers that don't belong here, | ||
96 | * you can add them at/after LanguageSpecificModifier | 96 | * you can add them at/after LanguageSpecificModifier | ||
97 | * @warning Think twice what information you store into the type-system. | 97 | * @warning Think twice what information you store into the type-system. | ||
98 | * The type-system should store information that is shared among many declarations, | 98 | * The type-system should store information that is shared among many declarations, | ||
99 | * and attributes of specific Declarations like public/private should be stored in | 99 | * and attributes of specific Declarations like public/private should be stored in | ||
100 | * the Declarations themselves, not in the type-system. | 100 | * the Declarations themselves, not in the type-system. | ||
101 | */ | 101 | */ | ||
102 | enum CommonModifiers { | 102 | enum CommonModifiers : quint32 { | ||
103 | NoModifiers = 0, | 103 | NoModifiers = 0, | ||
104 | | ||||
104 | ConstModifier = 1 << 0, | 105 | ConstModifier = 1 << 0, | ||
105 | VolatileModifier = 1 << 1, | 106 | VolatileModifier = 1 << 1, | ||
106 | TransientModifier = 1 << 2, | 107 | TransientModifier = 1 << 2, | ||
107 | NewModifier = 1 << 3, | 108 | NewModifier = 1 << 3, | ||
108 | SealedModifier = 1 << 4, | 109 | SealedModifier = 1 << 4, | ||
109 | UnsafeModifier = 1 << 5, | 110 | UnsafeModifier = 1 << 5, | ||
110 | FixedModifier = 1 << 6, | 111 | FixedModifier = 1 << 6, | ||
111 | ShortModifier = 1 << 7, | 112 | ShortModifier = 1 << 7, | ||
112 | LongModifier = 1 << 8, | 113 | LongModifier = 1 << 8, | ||
113 | LongLongModifier = 1 << 9, | 114 | LongLongModifier = 1 << 9, | ||
114 | SignedModifier = 1 << 10, | 115 | SignedModifier = 1 << 10, | ||
115 | UnsignedModifier = 1 << 11, | 116 | UnsignedModifier = 1 << 11, | ||
116 | LanguageSpecificModifier = 1 << 12 //TODO make this support 64 bit values | 117 | | ||
118 | LanguageSpecificModifier = 1 << 12 | ||||
mwolff: why this change? | |||||
117 | }; | 119 | }; | ||
118 | 120 | | |||
119 | /// Constructor. | 121 | /// Constructor. | ||
120 | AbstractType(); | 122 | AbstractType(); | ||
121 | /// Constructor from data. | 123 | /// Constructor from data. | ||
122 | explicit AbstractType(AbstractTypeData& dd); | 124 | explicit AbstractType(AbstractTypeData& dd); | ||
123 | /// Destructor. | 125 | /// Destructor. | ||
124 | virtual ~AbstractType (); | 126 | virtual ~AbstractType (); | ||
125 | 127 | | |||
126 | /** | 128 | /** | ||
127 | * Access the type modifiers | 129 | * Access the type modifiers | ||
128 | * | 130 | * | ||
129 | * \returns the type's modifiers. | 131 | * \returns the type's modifiers. | ||
130 | */ | 132 | */ | ||
131 | quint64 modifiers() const; | 133 | quint32 modifiers() const; | ||
as I note below, this should be checked whether any language plugin makes use of the 64bit space. if not, +1. otherwise -1 mwolff: as I note below, this should be checked whether any language plugin makes use of the 64bit… | |||||
Sure, I checked. LanguageSpecificModifier is never used outside of kdevplatform afaics. Each module calling AbstractType::setModifiers just reuses the common modifiers apparently. No need to extend to 64 bit at all, IMO (still plenty of space left now) kfunk: Sure, I checked. LanguageSpecificModifier is never used outside of kdevplatform afaics.
Each… | |||||
132 | 134 | | |||
133 | /** | 135 | /** | ||
134 | * Set the type's modifiers. | 136 | * Set the type's modifiers. | ||
135 | * | 137 | * | ||
136 | * \param modifiers modifiers of this type. | 138 | * \param modifiers modifiers of this type. | ||
137 | */ | 139 | */ | ||
138 | void setModifiers(quint64 modifiers); | 140 | void setModifiers(quint32 modifiers); | ||
139 | 141 | | |||
140 | /** | 142 | /** | ||
141 | * Visitor method. Called by TypeVisitor to visit the type heirachy. | 143 | * Visitor method. Called by TypeVisitor to visit the type heirachy. | ||
142 | * Do not reimplement this, reimplement accept0 instead. | 144 | * Do not reimplement this, reimplement accept0 instead. | ||
143 | * | 145 | * | ||
144 | * \param v visitor which is calling this function. | 146 | * \param v visitor which is calling this function. | ||
145 | */ | 147 | */ | ||
146 | void accept(TypeVisitor *v) const; | 148 | void accept(TypeVisitor *v) const; | ||
Show All 32 Lines | |||||
179 | * - When two types don't match on equals(), it should be different with a high probability. | 181 | * - When two types don't match on equals(), it should be different with a high probability. | ||
180 | * */ | 182 | * */ | ||
181 | virtual uint hash() const; | 183 | virtual uint hash() const; | ||
182 | 184 | | |||
183 | ///This can also be called on zero types, those can then be reconstructed from the zero index | 185 | ///This can also be called on zero types, those can then be reconstructed from the zero index | ||
184 | IndexedType indexed() const; | 186 | IndexedType indexed() const; | ||
185 | 187 | | |||
186 | /// Enumeration of major data types. | 188 | /// Enumeration of major data types. | ||
187 | enum WhichType { | 189 | enum WhichType : quint8 { | ||
188 | TypeAbstract /**< an abstract type */, | 190 | TypeAbstract /**< an abstract type */, | ||
189 | TypeIntegral /**< an integral */, | 191 | TypeIntegral /**< an integral */, | ||
190 | TypePointer /**< a pointer*/, | 192 | TypePointer /**< a pointer*/, | ||
191 | TypeReference /**< a reference */, | 193 | TypeReference /**< a reference */, | ||
192 | TypeFunction /**< a function */, | 194 | TypeFunction /**< a function */, | ||
193 | TypeStructure /**< a structure */, | 195 | TypeStructure /**< a structure */, | ||
194 | TypeArray /**< an array */, | 196 | TypeArray /**< an array */, | ||
195 | TypeDelayed /**< a delayed type */, | 197 | TypeDelayed /**< a delayed type */, | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
why this change?