Changeset 14cebb7a
- Timestamp:
- May 10, 2019, 9:31:29 AM (6 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:
- 36354b1
- Parents:
- 77a3f41
- Location:
- src/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Bitfield.hpp
r77a3f41 r14cebb7a 19 19 20 20 /// Make a type a bitfield. 21 /// Include in type definition to add operators. Used to simulate inheritance because union 21 /// Include in type definition to add operators. Used to simulate inheritance because union 22 22 /// does not allow it. Requires type to have `unsigned val` field 23 23 /// @param BFType Name of containing type -
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 ) {} -
src/AST/Label.hpp
r77a3f41 r14cebb7a 34 34 std::vector< ptr<Attribute> > attributes; 35 35 36 Label( CodeLocation loc, const std::string& name = "", 36 Label( CodeLocation loc, const std::string& name = "", 37 37 const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} ) 38 38 : location( loc ), name( name ), attributes( attrs ) {} … … 47 47 48 48 inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; } 49 49 50 50 } 51 51 -
src/AST/LinkageSpec.cpp
r77a3f41 r14cebb7a 54 54 } 55 55 } 56 56 57 57 } 58 58 -
src/AST/LinkageSpec.hpp
r77a3f41 r14cebb7a 49 49 50 50 /// If `cmd` = "C" returns `spec` with `is_mangled = false`. 51 /// If `cmd` = "Cforall" returns `spec` with `is_mangled = true`. 51 /// If `cmd` = "Cforall" returns `spec` with `is_mangled = true`. 52 52 Spec update( CodeLocation loc, Spec spec, const std::string * cmd ); 53 53 … … 56 56 57 57 // Pre-defined flag combinations 58 58 59 59 /// C built-in defined in prelude 60 60 constexpr Spec Intrinsic = { Mangle | Generate | Overrideable | Builtin }; -
src/AST/Node.hpp
r77a3f41 r14cebb7a 27 27 class Node { 28 28 public: 29 // override defaults to ensure assignment doesn't 29 // override defaults to ensure assignment doesn't 30 30 // change/share reference counts 31 31 Node() = default; -
src/AST/ParseNode.hpp
r77a3f41 r14cebb7a 28 28 29 29 // Default constructor is deliberately omitted, all ParseNodes must have a location. 30 // Escape hatch if needed is to explicitly pass a default-constructed location, but 30 // Escape hatch if needed is to explicitly pass a default-constructed location, but 31 31 // this should be used sparingly. 32 32 -
src/AST/porting.md
r77a3f41 r14cebb7a 59 59 * for concision and consistency with subclasses: 60 60 * `Declaration` => `ast::Decl` 61 * `DeclarationWithType` => `ast::DeclWithType` 61 * `DeclarationWithType` => `ast::DeclWithType` 62 62 * `Expression` => `ast::Expr` 63 63 * `Initializer` => `ast::Init`
Note: See TracChangeset
for help on using the changeset viewer.