Changeset 14cebb7a for src/AST/Decl.hpp
- Timestamp:
- May 10, 2019, 9:31:29 AM (4 years ago)
- Branches:
- arm-eh, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 36354b1
- Parents:
- 77a3f41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r77a3f41 r14cebb7a 46 46 bool extension = false; 47 47 48 Decl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 48 Decl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 49 49 Linkage::Spec linkage ) 50 50 : ParseNode( loc ), name( name ), storage( storage ), linkage( linkage ) {} … … 68 68 /// This field is generated by SymTab::Validate::Pass2 69 69 std::string mangleName; 70 /// Stores the scope level at which the variable was declared. 70 /// Stores the scope level at which the variable was declared. 71 71 /// Used to access shadowed identifiers. 72 72 int scopeLevel = 0; … … 77 77 bool isDeleted = false; 78 78 79 DeclWithType( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 79 DeclWithType( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 80 80 Linkage::Spec linkage, std::vector<ptr<Attribute>>&& attrs, Function::Specs fs ) 81 : Decl( loc, name, storage, linkage ), mangleName(), attributes( std::move(attrs) ), 81 : Decl( loc, name, storage, linkage ), mangleName(), attributes( std::move(attrs) ), 82 82 funcSpec(fs), asmName() {} 83 83 84 84 std::string scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); } 85 85 … … 102 102 103 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, 104 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::C, Expr* bitWd = nullptr, 105 105 std::vector<ptr<Attribute>>&& attrs = {}, Function::Specs fs = {}) 106 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), 106 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), 107 107 init( init ), bitfieldWidth( bitWd ) {} 108 108 109 109 const Type* get_type() const override { return type; } 110 110 void set_type( Type* ty ) override { type = ty; } … … 124 124 readonly<AggregateDecl> parent = {}; 125 125 126 AggregateDecl( const CodeLocation& loc, const std::string& name, 127 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 128 : Decl( loc, name, Storage::Classes{}, linkage ), members(), parameters(), 126 AggregateDecl( const CodeLocation& loc, const std::string& name, 127 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 128 : Decl( loc, name, Storage::Classes{}, linkage ), members(), parameters(), 129 129 attributes( std::move(attrs) ) {} 130 130 131 131 AggregateDecl* set_body( bool b ) { body = b; return this; } 132 132 … … 141 141 DeclarationNode::Aggregate kind; 142 142 143 StructDecl( const CodeLocation& loc, const std::string& name, 144 DeclarationNode::Aggregate kind = DeclarationNode::Struct, 143 StructDecl( const CodeLocation& loc, const std::string& name, 144 DeclarationNode::Aggregate kind = DeclarationNode::Struct, 145 145 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 146 146 : AggregateDecl( loc, name, std::move(attrs), linkage ), kind( kind ) {} … … 160 160 class UnionDecl final : public AggregateDecl { 161 161 public: 162 UnionDecl( const CodeLocation& loc, const std::string& name, 162 UnionDecl( const CodeLocation& loc, const std::string& name, 163 163 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 164 164 : AggregateDecl( loc, name, std::move(attrs), linkage ) {} … … 174 174 class EnumDecl final : public AggregateDecl { 175 175 public: 176 EnumDecl( const CodeLocation& loc, const std::string& name, 176 EnumDecl( const CodeLocation& loc, const std::string& name, 177 177 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 178 178 : AggregateDecl( loc, name, std::move(attrs), linkage ), enumValues() {} … … 194 194 class TraitDecl final : public AggregateDecl { 195 195 public: 196 TraitDecl( const CodeLocation& loc, const std::string& name, 196 TraitDecl( const CodeLocation& loc, const std::string& name, 197 197 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 198 198 : AggregateDecl( loc, name, std::move(attrs), linkage ) {}
Note: See TracChangeset
for help on using the changeset viewer.