Changeset aac5dfd for src/AST/Type.hpp
- Timestamp:
- Dec 12, 2020, 7:30:31 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5d1aa2f
- Parents:
- 6ce9a4f2 (diff), 4803a901 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Type.hpp
r6ce9a4f2 raac5dfd 267 267 }; 268 268 269 /// Base type for potentially forall-qualified types270 class ParameterizedType : public Type {271 protected:272 /// initializes forall with substitutor273 void initWithSub( const ParameterizedType & o, Pass< ForallSubstitutor > & sub );274 public:275 using ForallList = std::vector<ptr<TypeDecl>>;276 277 ForallList forall;278 279 ParameterizedType( ForallList&& fs = {}, CV::Qualifiers q = {},280 std::vector<ptr<Attribute>> && as = {} )281 : Type(q, std::move(as)), forall(std::move(fs)) {}282 283 ParameterizedType( CV::Qualifiers q, std::vector<ptr<Attribute>> && as = {} )284 : Type(q, std::move(as)), forall() {}285 286 // enforce use of ForallSubstitutor to copy parameterized type287 ParameterizedType( const ParameterizedType & ) = delete;288 289 ParameterizedType( ParameterizedType && ) = default;290 291 // no need to change destructor, and operator= deleted in Node292 293 private:294 virtual ParameterizedType * clone() const override = 0;295 MUTATE_FRIEND296 };297 298 269 /// Function variable arguments flag 299 270 enum ArgumentFlag { FixedArgs, VariableArgs }; 300 271 301 272 /// Type of a function `[R1, R2](*)(P1, P2, P3)` 302 class FunctionType final : public ParameterizedType { 303 public: 273 class FunctionType final : public Type { 274 protected: 275 /// initializes forall with substitutor 276 void initWithSub( const FunctionType & o, Pass< ForallSubstitutor > & sub ); 277 public: 278 using ForallList = std::vector<ptr<TypeDecl>>; 279 ForallList forall; 280 304 281 std::vector<ptr<Type>> returns; 305 282 std::vector<ptr<Type>> params; … … 313 290 314 291 FunctionType( ArgumentFlag va = FixedArgs, CV::Qualifiers q = {} ) 315 : ParameterizedType(q), returns(), params(), isVarArgs(va) {}292 : Type(q), returns(), params(), isVarArgs(va) {} 316 293 317 294 FunctionType( const FunctionType & o ); … … 329 306 330 307 /// base class for types that refer to types declared elsewhere (aggregates and typedefs) 331 class BaseInstType : public ParameterizedType { 332 protected: 333 /// Initializes forall and parameters based on substitutor 334 void initWithSub( const BaseInstType & o, Pass< ForallSubstitutor > & sub ); 308 class BaseInstType : public Type { 335 309 public: 336 310 std::vector<ptr<Expr>> params; … … 340 314 BaseInstType( 341 315 const std::string& n, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 342 : ParameterizedType(q, std::move(as)), params(), name(n) {}316 : Type(q, std::move(as)), params(), name(n) {} 343 317 344 318 BaseInstType( 345 319 const std::string& n, std::vector<ptr<Expr>> && params, 346 320 CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 347 : ParameterizedType(q, std::move(as)), params(std::move(params)), name(n) {}348 349 BaseInstType( const BaseInstType & o ) ;321 : Type(q, std::move(as)), params(std::move(params)), name(n) {} 322 323 BaseInstType( const BaseInstType & o ) = default; 350 324 351 325 /// Gets aggregate declaration this type refers to … … 433 407 : BaseInstType( n, q, std::move(as) ), base(), kind( k ) {} 434 408 435 TypeInstType( const TypeInstType & o ) ;409 TypeInstType( const TypeInstType & o ) = default; 436 410 437 411 /// sets `base`, updating `kind` correctly
Note: See TracChangeset
for help on using the changeset viewer.