ADT
arm-eh
ast-experimental
cleanup-dtors
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since be567e9 was e0115286, checked in by Thierry Delisle <tdelisle@…>, 6 years ago |
Fix a cyclic dependency with ptr and nodes
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[2bb4a01] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // ParseNode.hpp --
|
---|
| 8 | //
|
---|
| 9 | // Author : Aaron B. Moss
|
---|
| 10 | // Created On : Wed May 8 11:00:00 2019
|
---|
| 11 | // Last Modified By : Aaron B. Moss
|
---|
| 12 | // Last Modified On : Wed May 8 11:00:00 2019
|
---|
| 13 | // Update Count : 1
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
| 18 | #include "Node.hpp"
|
---|
| 19 |
|
---|
| 20 | #include "Common/CodeLocation.h"
|
---|
| 21 |
|
---|
| 22 | namespace ast {
|
---|
| 23 |
|
---|
[e0115286] | 24 | /// AST node with an included source location
|
---|
| 25 | class ParseNode : public Node {
|
---|
| 26 | public:
|
---|
| 27 | CodeLocation location;
|
---|
[2bb4a01] | 28 |
|
---|
[e0115286] | 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.
|
---|
[2bb4a01] | 32 |
|
---|
[e0115286] | 33 | ParseNode( const CodeLocation& loc ) : Node(), location(loc) {}
|
---|
[2bb4a01] | 34 |
|
---|
[e0115286] | 35 | ParseNode( const ParseNode& o ) = default;
|
---|
| 36 | };
|
---|
[2bb4a01] | 37 |
|
---|
[e0115286] | 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 ); }
|
---|
[2bb4a01] | 46 | }
|
---|
| 47 |
|
---|
| 48 | // Local Variables: //
|
---|
| 49 | // tab-width: 4 //
|
---|
| 50 | // mode: c++ //
|
---|
| 51 | // compile-command: "make install" //
|
---|
| 52 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.