- Timestamp:
- May 10, 2019, 3:00:41 PM (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:
- 2a5e8a6
- Parents:
- 1f93c2c
- Location:
- src/AST
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/AST/Decl.hpp ¶
r1f93c2c re0115286 122 122 std::vector<ptr<DeclWithType>> assertions; 123 123 124 NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 124 NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 125 125 Type* b, Linkage::Spec spec = Linkage::Cforall ) 126 126 : Decl( loc, name, storage, spec ), base( b ), parameters(), assertions() {} … … 149 149 Data( TypeDecl* d ) : kind( d->kind ), isComplete( d->sized ) {} 150 150 Data( Kind k, bool c ) : kind( k ), isComplete( c ) {} 151 Data( const Data& d1, const Data& d2 ) 151 Data( const Data& d1, const Data& d2 ) 152 152 : kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {} 153 153 … … 158 158 }; 159 159 160 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 160 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 161 161 Kind k, bool s, Type* i = nullptr ) 162 162 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == Ttype || s ), init( i ) {} … … 174 174 class TypedefDecl final : public NamedTypeDecl { 175 175 public: 176 TypedefDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 176 TypedefDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 177 177 Type* b, Linkage::Spec spec = Linkage::Cforall ) 178 178 : NamedTypeDecl( loc, name, storage, b, spec ) {} … … 275 275 }; 276 276 277 278 //================================================================================================= 279 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 280 /// remove only if there is a better solution 281 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 282 /// forward declarations 283 inline void increment( const class Decl * node, Node::ref_type ref ) { node->increment(ref); } 284 inline void decrement( const class Decl * node, Node::ref_type ref ) { node->decrement(ref); } 285 inline void increment( const class DeclWithType * node, Node::ref_type ref ) { node->increment(ref); } 286 inline void decrement( const class DeclWithType * node, Node::ref_type ref ) { node->decrement(ref); } 287 inline void increment( const class ObjectDecl * node, Node::ref_type ref ) { node->increment(ref); } 288 inline void decrement( const class ObjectDecl * node, Node::ref_type ref ) { node->decrement(ref); } 289 inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); } 290 inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); } 291 inline void increment( const class AggregateDecl * node, Node::ref_type ref ) { node->increment(ref); } 292 inline void decrement( const class AggregateDecl * node, Node::ref_type ref ) { node->decrement(ref); } 293 inline void increment( const class StructDecl * node, Node::ref_type ref ) { node->increment(ref); } 294 inline void decrement( const class StructDecl * node, Node::ref_type ref ) { node->decrement(ref); } 295 inline void increment( const class UnionDecl * node, Node::ref_type ref ) { node->increment(ref); } 296 inline void decrement( const class UnionDecl * node, Node::ref_type ref ) { node->decrement(ref); } 297 inline void increment( const class EnumDecl * node, Node::ref_type ref ) { node->increment(ref); } 298 inline void decrement( const class EnumDecl * node, Node::ref_type ref ) { node->decrement(ref); } 299 inline void increment( const class TraitDecl * node, Node::ref_type ref ) { node->increment(ref); } 300 inline void decrement( const class TraitDecl * node, Node::ref_type ref ) { node->decrement(ref); } 301 inline void increment( const class NamedTypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 302 inline void decrement( const class NamedTypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 303 inline void increment( const class TypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 304 inline void decrement( const class TypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 305 inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 306 inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 307 inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 308 inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 309 inline void increment( const class TypedefDecl * node, Node::ref_type ref ) { node->increment(ref); } 310 inline void decrement( const class TypedefDecl * node, Node::ref_type ref ) { node->decrement(ref); } 311 inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); } 312 inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); } 313 inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); } 314 inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); } 315 277 316 } 278 317 -
TabularUnified src/AST/Fwd.hpp ¶
r1f93c2c re0115286 16 16 #pragma once 17 17 18 #include "AST/Node.hpp" 19 18 20 namespace ast { 19 21 20 class Node;21 22 class ParseNode; 22 23 … … 137 138 class TypeSubstitution; 138 139 140 //================================================================================================= 141 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 142 /// remove only if there is a better solution 143 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 144 /// forward declarations 145 inline void decrement( const class Node * node, Node::ref_type ref ) { node->decrement(ref); } 146 inline void increment( const class Node * node, Node::ref_type ref ) { node->increment(ref); } 147 inline void increment( const class ParseNode *, Node::ref_type ); 148 inline void decrement( const class ParseNode *, Node::ref_type ); 149 inline void increment( const class Decl *, Node::ref_type ); 150 inline void decrement( const class Decl *, Node::ref_type ); 151 inline void increment( const class DeclWithType *, Node::ref_type ); 152 inline void decrement( const class DeclWithType *, Node::ref_type ); 153 inline void increment( const class ObjectDecl *, Node::ref_type ); 154 inline void decrement( const class ObjectDecl *, Node::ref_type ); 155 inline void increment( const class FunctionDecl *, Node::ref_type ); 156 inline void decrement( const class FunctionDecl *, Node::ref_type ); 157 inline void increment( const class AggregateDecl *, Node::ref_type ); 158 inline void decrement( const class AggregateDecl *, Node::ref_type ); 159 inline void increment( const class StructDecl *, Node::ref_type ); 160 inline void decrement( const class StructDecl *, Node::ref_type ); 161 inline void increment( const class UnionDecl *, Node::ref_type ); 162 inline void decrement( const class UnionDecl *, Node::ref_type ); 163 inline void increment( const class EnumDecl *, Node::ref_type ); 164 inline void decrement( const class EnumDecl *, Node::ref_type ); 165 inline void increment( const class TraitDecl *, Node::ref_type ); 166 inline void decrement( const class TraitDecl *, Node::ref_type ); 167 inline void increment( const class NamedTypeDecl *, Node::ref_type ); 168 inline void decrement( const class NamedTypeDecl *, Node::ref_type ); 169 inline void increment( const class TypeDecl *, Node::ref_type ); 170 inline void decrement( const class TypeDecl *, Node::ref_type ); 171 inline void increment( const class FtypeDecl *, Node::ref_type ); 172 inline void decrement( const class FtypeDecl *, Node::ref_type ); 173 inline void increment( const class DtypeDecl *, Node::ref_type ); 174 inline void decrement( const class DtypeDecl *, Node::ref_type ); 175 inline void increment( const class TypedefDecl *, Node::ref_type ); 176 inline void decrement( const class TypedefDecl *, Node::ref_type ); 177 inline void increment( const class AsmDecl *, Node::ref_type ); 178 inline void decrement( const class AsmDecl *, Node::ref_type ); 179 inline void increment( const class StaticAssertDecl *, Node::ref_type ); 180 inline void decrement( const class StaticAssertDecl *, Node::ref_type ); 181 inline void increment( const class Stmt *, Node::ref_type ); 182 inline void decrement( const class Stmt *, Node::ref_type ); 183 inline void increment( const class CompoundStmt *, Node::ref_type ); 184 inline void decrement( const class CompoundStmt *, Node::ref_type ); 185 inline void increment( const class ExprStmt *, Node::ref_type ); 186 inline void decrement( const class ExprStmt *, Node::ref_type ); 187 inline void increment( const class AsmStmt *, Node::ref_type ); 188 inline void decrement( const class AsmStmt *, Node::ref_type ); 189 inline void increment( const class DirectiveStmt *, Node::ref_type ); 190 inline void decrement( const class DirectiveStmt *, Node::ref_type ); 191 inline void increment( const class IfStmt *, Node::ref_type ); 192 inline void decrement( const class IfStmt *, Node::ref_type ); 193 inline void increment( const class WhileStmt *, Node::ref_type ); 194 inline void decrement( const class WhileStmt *, Node::ref_type ); 195 inline void increment( const class ForStmt *, Node::ref_type ); 196 inline void decrement( const class ForStmt *, Node::ref_type ); 197 inline void increment( const class SwitchStmt *, Node::ref_type ); 198 inline void decrement( const class SwitchStmt *, Node::ref_type ); 199 inline void increment( const class CaseStmt *, Node::ref_type ); 200 inline void decrement( const class CaseStmt *, Node::ref_type ); 201 inline void increment( const class BranchStmt *, Node::ref_type ); 202 inline void decrement( const class BranchStmt *, Node::ref_type ); 203 inline void increment( const class ReturnStmt *, Node::ref_type ); 204 inline void decrement( const class ReturnStmt *, Node::ref_type ); 205 inline void increment( const class ThrowStmt *, Node::ref_type ); 206 inline void decrement( const class ThrowStmt *, Node::ref_type ); 207 inline void increment( const class TryStmt *, Node::ref_type ); 208 inline void decrement( const class TryStmt *, Node::ref_type ); 209 inline void increment( const class CatchStmt *, Node::ref_type ); 210 inline void decrement( const class CatchStmt *, Node::ref_type ); 211 inline void increment( const class FinallyStmt *, Node::ref_type ); 212 inline void decrement( const class FinallyStmt *, Node::ref_type ); 213 inline void increment( const class WaitForStmt *, Node::ref_type ); 214 inline void decrement( const class WaitForStmt *, Node::ref_type ); 215 inline void increment( const class WithStmt *, Node::ref_type ); 216 inline void decrement( const class WithStmt *, Node::ref_type ); 217 inline void increment( const class DeclStmt *, Node::ref_type ); 218 inline void decrement( const class DeclStmt *, Node::ref_type ); 219 inline void increment( const class NullStmt *, Node::ref_type ); 220 inline void decrement( const class NullStmt *, Node::ref_type ); 221 inline void increment( const class ImplicitCtorDtorStmt *, Node::ref_type ); 222 inline void decrement( const class ImplicitCtorDtorStmt *, Node::ref_type ); 223 inline void increment( const class Expr *, Node::ref_type ); 224 inline void decrement( const class Expr *, Node::ref_type ); 225 inline void increment( const class ApplicationExpr *, Node::ref_type ); 226 inline void decrement( const class ApplicationExpr *, Node::ref_type ); 227 inline void increment( const class UntypedExpr *, Node::ref_type ); 228 inline void decrement( const class UntypedExpr *, Node::ref_type ); 229 inline void increment( const class NameExpr *, Node::ref_type ); 230 inline void decrement( const class NameExpr *, Node::ref_type ); 231 inline void increment( const class AddressExpr *, Node::ref_type ); 232 inline void decrement( const class AddressExpr *, Node::ref_type ); 233 inline void increment( const class LabelAddressExpr *, Node::ref_type ); 234 inline void decrement( const class LabelAddressExpr *, Node::ref_type ); 235 inline void increment( const class CastExpr *, Node::ref_type ); 236 inline void decrement( const class CastExpr *, Node::ref_type ); 237 inline void increment( const class KeywordCastExpr *, Node::ref_type ); 238 inline void decrement( const class KeywordCastExpr *, Node::ref_type ); 239 inline void increment( const class VirtualCastExpr *, Node::ref_type ); 240 inline void decrement( const class VirtualCastExpr *, Node::ref_type ); 241 inline void increment( const class MemberExpr *, Node::ref_type ); 242 inline void decrement( const class MemberExpr *, Node::ref_type ); 243 inline void increment( const class UntypedMemberExpr *, Node::ref_type ); 244 inline void decrement( const class UntypedMemberExpr *, Node::ref_type ); 245 inline void increment( const class VariableExpr *, Node::ref_type ); 246 inline void decrement( const class VariableExpr *, Node::ref_type ); 247 inline void increment( const class ConstantExpr *, Node::ref_type ); 248 inline void decrement( const class ConstantExpr *, Node::ref_type ); 249 inline void increment( const class SizeofExpr *, Node::ref_type ); 250 inline void decrement( const class SizeofExpr *, Node::ref_type ); 251 inline void increment( const class AlignofExpr *, Node::ref_type ); 252 inline void decrement( const class AlignofExpr *, Node::ref_type ); 253 inline void increment( const class UntypedOffsetofExpr *, Node::ref_type ); 254 inline void decrement( const class UntypedOffsetofExpr *, Node::ref_type ); 255 inline void increment( const class OffsetofExpr *, Node::ref_type ); 256 inline void decrement( const class OffsetofExpr *, Node::ref_type ); 257 inline void increment( const class OffsetPackExpr *, Node::ref_type ); 258 inline void decrement( const class OffsetPackExpr *, Node::ref_type ); 259 inline void increment( const class AttrExpr *, Node::ref_type ); 260 inline void decrement( const class AttrExpr *, Node::ref_type ); 261 inline void increment( const class LogicalExpr *, Node::ref_type ); 262 inline void decrement( const class LogicalExpr *, Node::ref_type ); 263 inline void increment( const class ConditionalExpr *, Node::ref_type ); 264 inline void decrement( const class ConditionalExpr *, Node::ref_type ); 265 inline void increment( const class CommaExpr *, Node::ref_type ); 266 inline void decrement( const class CommaExpr *, Node::ref_type ); 267 inline void increment( const class TypeExpr *, Node::ref_type ); 268 inline void decrement( const class TypeExpr *, Node::ref_type ); 269 inline void increment( const class AsmExpr *, Node::ref_type ); 270 inline void decrement( const class AsmExpr *, Node::ref_type ); 271 inline void increment( const class ImplicitCopyCtorExpr *, Node::ref_type ); 272 inline void decrement( const class ImplicitCopyCtorExpr *, Node::ref_type ); 273 inline void increment( const class ConstructorExpr *, Node::ref_type ); 274 inline void decrement( const class ConstructorExpr *, Node::ref_type ); 275 inline void increment( const class CompoundLiteralExpr *, Node::ref_type ); 276 inline void decrement( const class CompoundLiteralExpr *, Node::ref_type ); 277 inline void increment( const class UntypedValofExpr *, Node::ref_type ); 278 inline void decrement( const class UntypedValofExpr *, Node::ref_type ); 279 inline void increment( const class RangeExpr *, Node::ref_type ); 280 inline void decrement( const class RangeExpr *, Node::ref_type ); 281 inline void increment( const class UntypedTupleExpr *, Node::ref_type ); 282 inline void decrement( const class UntypedTupleExpr *, Node::ref_type ); 283 inline void increment( const class TupleExpr *, Node::ref_type ); 284 inline void decrement( const class TupleExpr *, Node::ref_type ); 285 inline void increment( const class TupleIndexExpr *, Node::ref_type ); 286 inline void decrement( const class TupleIndexExpr *, Node::ref_type ); 287 inline void increment( const class TupleAssignExpr *, Node::ref_type ); 288 inline void decrement( const class TupleAssignExpr *, Node::ref_type ); 289 inline void increment( const class StmtExpr *, Node::ref_type ); 290 inline void decrement( const class StmtExpr *, Node::ref_type ); 291 inline void increment( const class UniqueExpr *, Node::ref_type ); 292 inline void decrement( const class UniqueExpr *, Node::ref_type ); 293 inline void increment( const class UntypedInitExpr *, Node::ref_type ); 294 inline void decrement( const class UntypedInitExpr *, Node::ref_type ); 295 inline void increment( const class InitExpr *, Node::ref_type ); 296 inline void decrement( const class InitExpr *, Node::ref_type ); 297 inline void increment( const class DeletedExpr *, Node::ref_type ); 298 inline void decrement( const class DeletedExpr *, Node::ref_type ); 299 inline void increment( const class DefaultArgExpr *, Node::ref_type ); 300 inline void decrement( const class DefaultArgExpr *, Node::ref_type ); 301 inline void increment( const class GenericExpr *, Node::ref_type ); 302 inline void decrement( const class GenericExpr *, Node::ref_type ); 303 inline void increment( const class Type *, Node::ref_type ); 304 inline void decrement( const class Type *, Node::ref_type ); 305 inline void increment( const class VoidType *, Node::ref_type ); 306 inline void decrement( const class VoidType *, Node::ref_type ); 307 inline void increment( const class BasicType *, Node::ref_type ); 308 inline void decrement( const class BasicType *, Node::ref_type ); 309 inline void increment( const class PointerType *, Node::ref_type ); 310 inline void decrement( const class PointerType *, Node::ref_type ); 311 inline void increment( const class ArrayType *, Node::ref_type ); 312 inline void decrement( const class ArrayType *, Node::ref_type ); 313 inline void increment( const class ReferenceType *, Node::ref_type ); 314 inline void decrement( const class ReferenceType *, Node::ref_type ); 315 inline void increment( const class QualifiedType *, Node::ref_type ); 316 inline void decrement( const class QualifiedType *, Node::ref_type ); 317 inline void increment( const class FunctionType *, Node::ref_type ); 318 inline void decrement( const class FunctionType *, Node::ref_type ); 319 inline void increment( const class ReferenceToType *, Node::ref_type ); 320 inline void decrement( const class ReferenceToType *, Node::ref_type ); 321 inline void increment( const class StructInstType *, Node::ref_type ); 322 inline void decrement( const class StructInstType *, Node::ref_type ); 323 inline void increment( const class UnionInstType *, Node::ref_type ); 324 inline void decrement( const class UnionInstType *, Node::ref_type ); 325 inline void increment( const class EnumInstType *, Node::ref_type ); 326 inline void decrement( const class EnumInstType *, Node::ref_type ); 327 inline void increment( const class TraitInstType *, Node::ref_type ); 328 inline void decrement( const class TraitInstType *, Node::ref_type ); 329 inline void increment( const class TypeInstType *, Node::ref_type ); 330 inline void decrement( const class TypeInstType *, Node::ref_type ); 331 inline void increment( const class TupleType *, Node::ref_type ); 332 inline void decrement( const class TupleType *, Node::ref_type ); 333 inline void increment( const class TypeofType *, Node::ref_type ); 334 inline void decrement( const class TypeofType *, Node::ref_type ); 335 inline void increment( const class AttrType *, Node::ref_type ); 336 inline void decrement( const class AttrType *, Node::ref_type ); 337 inline void increment( const class VarArgsType *, Node::ref_type ); 338 inline void decrement( const class VarArgsType *, Node::ref_type ); 339 inline void increment( const class ZeroType *, Node::ref_type ); 340 inline void decrement( const class ZeroType *, Node::ref_type ); 341 inline void increment( const class OneType *, Node::ref_type ); 342 inline void decrement( const class OneType *, Node::ref_type ); 343 inline void increment( const class GlobalScopeType *, Node::ref_type ); 344 inline void decrement( const class GlobalScopeType *, Node::ref_type ); 345 inline void increment( const class Designation *, Node::ref_type ); 346 inline void decrement( const class Designation *, Node::ref_type ); 347 inline void increment( const class Init *, Node::ref_type ); 348 inline void decrement( const class Init *, Node::ref_type ); 349 inline void increment( const class SingleInit *, Node::ref_type ); 350 inline void decrement( const class SingleInit *, Node::ref_type ); 351 inline void increment( const class ListInit *, Node::ref_type ); 352 inline void decrement( const class ListInit *, Node::ref_type ); 353 inline void increment( const class ConstructorInit *, Node::ref_type ); 354 inline void decrement( const class ConstructorInit *, Node::ref_type ); 355 inline void increment( const class Constant *, Node::ref_type ); 356 inline void decrement( const class Constant *, Node::ref_type ); 357 inline void increment( const class Label *, Node::ref_type ); 358 inline void decrement( const class Label *, Node::ref_type ); 359 inline void increment( const class Attribute *, Node::ref_type ); 360 inline void decrement( const class Attribute *, Node::ref_type ); 361 inline void increment( const class TypeSubstitution *, Node::ref_type ); 362 inline void decrement( const class TypeSubstitution *, Node::ref_type ); 363 139 364 typedef unsigned int UniqueId; 140 365 -
TabularUnified src/AST/Init.hpp ¶
r1f93c2c re0115286 28 28 class Stmt; 29 29 30 /// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an 30 /// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an 31 31 /// object being initialized 32 32 class Designation final : public ParseNode { … … 34 34 std::vector<ptr<Expr>> designators; 35 35 36 Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} ) 36 Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} ) 37 37 : ParseNode( loc ), designators( std::move(ds) ) {} 38 38 … … 60 60 ptr<Expr> value; 61 61 62 SingleInit( const CodeLocation& loc, Expr* val, bool mc = false ) 62 SingleInit( const CodeLocation& loc, Expr* val, bool mc = false ) 63 63 : Init( loc, mc ), value( val ) {} 64 64 … … 77 77 std::vector<ptr<Designation>> designations; 78 78 79 ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is, 79 ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is, 80 80 std::vector<ptr<Designation>>&& ds = {}, bool mc = false ); 81 81 82 82 using iterator = std::vector<ptr<Init>>::iterator; 83 83 using const_iterator = std::vector<ptr<Init>>::const_iterator; … … 93 93 94 94 /// Either a constructor expression or a C-style initializer. 95 /// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit` 95 /// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit` 96 96 /// or `ListInit` if the object should be constructed. 97 97 class ConstructorInit final : public Init { … … 99 99 ptr<Stmt> ctor; 100 100 ptr<Stmt> dtor; 101 /// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an 101 /// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an 102 102 /// appropriate constructor definition is not found by the resolver. 103 103 ptr<Init> init; … … 111 111 }; 112 112 113 114 //================================================================================================= 115 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 116 /// remove only if there is a better solution 117 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 118 /// forward declarations 119 inline void increment( const class Init * node, Node::ref_type ref ) { node->increment( ref ); } 120 inline void decrement( const class Init * node, Node::ref_type ref ) { node->decrement( ref ); } 121 inline void increment( const class SingleInit * node, Node::ref_type ref ) { node->increment( ref ); } 122 inline void decrement( const class SingleInit * node, Node::ref_type ref ) { node->decrement( ref ); } 123 inline void increment( const class ListInit * node, Node::ref_type ref ) { node->increment( ref ); } 124 inline void decrement( const class ListInit * node, Node::ref_type ref ) { node->decrement( ref ); } 125 inline void increment( const class ConstructorInit * node, Node::ref_type ref ) { node->increment( ref ); } 126 inline void decrement( const class ConstructorInit * node, Node::ref_type ref ) { node->decrement( ref ); } 113 127 } 114 128 -
TabularUnified src/AST/Label.hpp ¶
r1f93c2c re0115286 25 25 namespace ast { 26 26 27 27 class Attribute; 28 28 29 30 31 32 33 34 29 /// Named labels for statements 30 class Label { 31 public: 32 CodeLocation location; 33 std::string name; 34 std::vector< ptr<Attribute> > attributes; 35 35 36 37 38 36 Label( CodeLocation loc, const std::string& name = "", 37 const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} ) 38 : location( loc ), name( name ), attributes( attrs ) {} 39 39 40 41 42 40 operator std::string () const { return name; } 41 bool empty() { return name.empty(); } 42 }; 43 43 44 45 46 44 inline bool operator== ( const Label& l1, const Label& l2 ) { return l1.name == l2.name; } 45 inline bool operator!= ( const Label& l1, const Label& l2 ) { return !(l1 == l2); } 46 inline bool operator< ( const Label& l1, const Label& l2 ) { return l1.name < l2.name; } 47 47 48 inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; } 48 inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; } 49 50 51 //================================================================================================= 52 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 53 /// remove only if there is a better solution 54 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 55 /// forward declarations 56 inline void increment( const class Label * node, Node::ref_type ref ) { node->increment( ref ); } 57 inline void decrement( const class Label * node, Node::ref_type ref ) { node->decrement( ref ); } 49 58 50 59 } -
TabularUnified src/AST/ParseNode.hpp ¶
r1f93c2c re0115286 22 22 namespace ast { 23 23 24 25 26 27 24 /// AST node with an included source location 25 class ParseNode : public Node { 26 public: 27 CodeLocation location; 28 28 29 30 31 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 31 // this should be used sparingly. 32 32 33 33 ParseNode( const CodeLocation& loc ) : Node(), location(loc) {} 34 34 35 36 35 ParseNode( const ParseNode& o ) = default; 36 }; 37 37 38 39 //================================================================================================= 40 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 41 /// remove only if there is a better solution 42 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 43 /// forward declarations 44 inline void increment( const class ParseNode * node, Node::ref_type ref ) { node->increment( ref ); } 45 inline void decrement( const class ParseNode * node, Node::ref_type ref ) { node->decrement( ref ); } 38 46 } 39 47 -
TabularUnified src/AST/Stmt.hpp ¶
r1f93c2c re0115286 89 89 90 90 91 //================================================================================================= 92 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 93 /// remove only if there is a better solution 94 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 95 /// forward declarations 96 inline void increment( const class Stmt * node, Node::ref_type ref ) { node->increment( ref ); } 97 inline void decrement( const class Stmt * node, Node::ref_type ref ) { node->decrement( ref ); } 98 inline void increment( const class CompoundStmt * node, Node::ref_type ref ) { node->increment( ref ); } 99 inline void decrement( const class CompoundStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 100 inline void increment( const class ExprStmt * node, Node::ref_type ref ) { node->increment( ref ); } 101 inline void decrement( const class ExprStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 102 inline void increment( const class AsmStmt * node, Node::ref_type ref ) { node->increment( ref ); } 103 inline void decrement( const class AsmStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 104 inline void increment( const class DirectiveStmt * node, Node::ref_type ref ) { node->increment( ref ); } 105 inline void decrement( const class DirectiveStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 106 inline void increment( const class IfStmt * node, Node::ref_type ref ) { node->increment( ref ); } 107 inline void decrement( const class IfStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 108 inline void increment( const class WhileStmt * node, Node::ref_type ref ) { node->increment( ref ); } 109 inline void decrement( const class WhileStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 110 inline void increment( const class ForStmt * node, Node::ref_type ref ) { node->increment( ref ); } 111 inline void decrement( const class ForStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 112 inline void increment( const class SwitchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 113 inline void decrement( const class SwitchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 114 inline void increment( const class CaseStmt * node, Node::ref_type ref ) { node->increment( ref ); } 115 inline void decrement( const class CaseStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 116 inline void increment( const class BranchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 117 inline void decrement( const class BranchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 118 inline void increment( const class ReturnStmt * node, Node::ref_type ref ) { node->increment( ref ); } 119 inline void decrement( const class ReturnStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 120 inline void increment( const class ThrowStmt * node, Node::ref_type ref ) { node->increment( ref ); } 121 inline void decrement( const class ThrowStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 122 inline void increment( const class TryStmt * node, Node::ref_type ref ) { node->increment( ref ); } 123 inline void decrement( const class TryStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 124 inline void increment( const class CatchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 125 inline void decrement( const class CatchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 126 inline void increment( const class FinallyStmt * node, Node::ref_type ref ) { node->increment( ref ); } 127 inline void decrement( const class FinallyStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 128 inline void increment( const class WaitForStmt * node, Node::ref_type ref ) { node->increment( ref ); } 129 inline void decrement( const class WaitForStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 130 inline void increment( const class WithStmt * node, Node::ref_type ref ) { node->increment( ref ); } 131 inline void decrement( const class WithStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 132 inline void increment( const class DeclStmt * node, Node::ref_type ref ) { node->increment( ref ); } 133 inline void decrement( const class DeclStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 134 inline void increment( const class NullStmt * node, Node::ref_type ref ) { node->increment( ref ); } 135 inline void decrement( const class NullStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 136 inline void increment( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->increment( ref ); } 137 inline void decrement( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 138 91 139 } 92 140 -
TabularUnified src/AST/Type.hpp ¶
r1f93c2c re0115286 24 24 }; 25 25 26 27 28 //================================================================================================= 29 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 30 /// remove only if there is a better solution 31 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 32 /// forward declarations 33 inline void increment( const class Type * node, Node::ref_type ref ) { node->increment( ref ); } 34 inline void decrement( const class Type * node, Node::ref_type ref ) { node->decrement( ref ); } 35 inline void increment( const class VoidType * node, Node::ref_type ref ) { node->increment( ref ); } 36 inline void decrement( const class VoidType * node, Node::ref_type ref ) { node->decrement( ref ); } 37 inline void increment( const class BasicType * node, Node::ref_type ref ) { node->increment( ref ); } 38 inline void decrement( const class BasicType * node, Node::ref_type ref ) { node->decrement( ref ); } 39 inline void increment( const class PointerType * node, Node::ref_type ref ) { node->increment( ref ); } 40 inline void decrement( const class PointerType * node, Node::ref_type ref ) { node->decrement( ref ); } 41 inline void increment( const class ArrayType * node, Node::ref_type ref ) { node->increment( ref ); } 42 inline void decrement( const class ArrayType * node, Node::ref_type ref ) { node->decrement( ref ); } 43 inline void increment( const class ReferenceType * node, Node::ref_type ref ) { node->increment( ref ); } 44 inline void decrement( const class ReferenceType * node, Node::ref_type ref ) { node->decrement( ref ); } 45 inline void increment( const class QualifiedType * node, Node::ref_type ref ) { node->increment( ref ); } 46 inline void decrement( const class QualifiedType * node, Node::ref_type ref ) { node->decrement( ref ); } 47 inline void increment( const class FunctionType * node, Node::ref_type ref ) { node->increment( ref ); } 48 inline void decrement( const class FunctionType * node, Node::ref_type ref ) { node->decrement( ref ); } 49 inline void increment( const class ReferenceToType * node, Node::ref_type ref ) { node->increment( ref ); } 50 inline void decrement( const class ReferenceToType * node, Node::ref_type ref ) { node->decrement( ref ); } 51 inline void increment( const class StructInstType * node, Node::ref_type ref ) { node->increment( ref ); } 52 inline void decrement( const class StructInstType * node, Node::ref_type ref ) { node->decrement( ref ); } 53 inline void increment( const class UnionInstType * node, Node::ref_type ref ) { node->increment( ref ); } 54 inline void decrement( const class UnionInstType * node, Node::ref_type ref ) { node->decrement( ref ); } 55 inline void increment( const class EnumInstType * node, Node::ref_type ref ) { node->increment( ref ); } 56 inline void decrement( const class EnumInstType * node, Node::ref_type ref ) { node->decrement( ref ); } 57 inline void increment( const class TraitInstType * node, Node::ref_type ref ) { node->increment( ref ); } 58 inline void decrement( const class TraitInstType * node, Node::ref_type ref ) { node->decrement( ref ); } 59 inline void increment( const class TypeInstType * node, Node::ref_type ref ) { node->increment( ref ); } 60 inline void decrement( const class TypeInstType * node, Node::ref_type ref ) { node->decrement( ref ); } 61 inline void increment( const class TupleType * node, Node::ref_type ref ) { node->increment( ref ); } 62 inline void decrement( const class TupleType * node, Node::ref_type ref ) { node->decrement( ref ); } 63 inline void increment( const class TypeofType * node, Node::ref_type ref ) { node->increment( ref ); } 64 inline void decrement( const class TypeofType * node, Node::ref_type ref ) { node->decrement( ref ); } 65 inline void increment( const class AttrType * node, Node::ref_type ref ) { node->increment( ref ); } 66 inline void decrement( const class AttrType * node, Node::ref_type ref ) { node->decrement( ref ); } 67 inline void increment( const class VarArgsType * node, Node::ref_type ref ) { node->increment( ref ); } 68 inline void decrement( const class VarArgsType * node, Node::ref_type ref ) { node->decrement( ref ); } 69 inline void increment( const class ZeroType * node, Node::ref_type ref ) { node->increment( ref ); } 70 inline void decrement( const class ZeroType * node, Node::ref_type ref ) { node->decrement( ref ); } 71 inline void increment( const class OneType * node, Node::ref_type ref ) { node->increment( ref ); } 72 inline void decrement( const class OneType * node, Node::ref_type ref ) { node->decrement( ref ); } 73 inline void increment( const class GlobalScopeType * node, Node::ref_type ref ) { node->increment( ref ); } 74 inline void decrement( const class GlobalScopeType * node, Node::ref_type ref ) { node->decrement( ref ); } 75 26 76 } 27 77
Note: See TracChangeset
for help on using the changeset viewer.