Changeset 77a3f41
- Timestamp:
- May 9, 2019, 5:53:29 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 14cebb7a
- Parents:
- 3e46cc8
- Location:
- src/AST
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r3e46cc8 r77a3f41 34 34 class Attribute; 35 35 class Expr; 36 class Init; 36 37 class TypeDecl; 37 38 … … 84 85 85 86 /// Get type of this declaration. May be generated by subclass 86 virtual const Type* type() const = 0;87 virtual const Type* get_type() const = 0; 87 88 /// Set type of this declaration. May be verified by subclass 88 89 virtual void set_type(Type*) = 0; … … 91 92 private: 92 93 virtual DeclWithType* clone() const override = 0; 94 }; 95 96 /// Object declaration `Foo foo = 42;` 97 class ObjectDecl final : public DeclWithType { 98 public: 99 ptr<Type> type; 100 ptr<Init> init; 101 ptr<Expr> bitfieldWidth; 102 103 ObjectDecl( const CodeLocation& loc, const std::string& name, Type* type, Init* init = nullptr, 104 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::C, Expr* bitWd = nullptr, 105 std::vector<ptr<Attribute>>&& attrs = {}, Function::Specs fs = {}) 106 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), 107 init( init ), bitfieldWidth( bitWd ) {} 108 109 const Type* get_type() const override { return type; } 110 void set_type( Type* ty ) override { type = ty; } 111 112 DeclWithType* accept( Visitor& v ) override { return v.visit( this ); } 113 private: 114 ObjectDecl* clone() const override { return new ObjectDecl{ *this }; } 93 115 }; 94 116 -
src/AST/porting.md
r3e46cc8 r77a3f41 82 82 * When `SymTab::Validate::Pass2` is rewritten, update comment on `mangleName` with new name of pass 83 83 * `get_scopedMangleName()` => `scopedMangleName()` 84 * `get_type()` => `type()` 85 * now returns `const Type*` so can't be inadvertently mutated 84 * `get_type()` now returns `const Type*` so can't be inadvertently mutated 85 * still with `get_` name so it doesn't conflict with subclass field names 86 87 `ObjectDecl` 88 * changed constructor parameter order for better defaults 89 * allows `newObject` as just default settings 86 90 87 91 `EnumDecl`
Note: See TracChangeset
for help on using the changeset viewer.