ADT
arm-eh
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since 8d70648 was 94b1f718, checked in by Aaron Moss <a3moss@…>, 6 years ago |
Add some Stmt printers
|
-
Property mode
set to
100644
|
File size:
1.4 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 | // Label.hpp --
|
---|
| 8 | //
|
---|
| 9 | // Author : Aaron B. Moss
|
---|
| 10 | // Created On : Wed May 8 13:00:00 2019
|
---|
| 11 | // Last Modified By : Aaron B. Moss
|
---|
| 12 | // Last Modified On : Wed May 8 13:00:00 2019
|
---|
| 13 | // Update Count : 1
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
| 18 | #include <iostream>
|
---|
| 19 | #include <string>
|
---|
| 20 | #include <vector>
|
---|
| 21 |
|
---|
| 22 | #include "Node.hpp"
|
---|
| 23 | #include "Common/CodeLocation.h"
|
---|
| 24 |
|
---|
| 25 | namespace ast {
|
---|
| 26 |
|
---|
[e0115286] | 27 | class Attribute;
|
---|
[2bb4a01] | 28 |
|
---|
[e0115286] | 29 | /// Named labels for statements
|
---|
| 30 | class Label {
|
---|
| 31 | public:
|
---|
| 32 | CodeLocation location;
|
---|
| 33 | std::string name;
|
---|
| 34 | std::vector< ptr<Attribute> > attributes;
|
---|
[2bb4a01] | 35 |
|
---|
[e0115286] | 36 | Label( CodeLocation loc, const std::string& name = "",
|
---|
[6d51bd7] | 37 | std::vector<ptr<Attribute>> && attrs = std::vector<ptr<Attribute>>{} )
|
---|
[e0115286] | 38 | : location( loc ), name( name ), attributes( attrs ) {}
|
---|
[2bb4a01] | 39 |
|
---|
[e0115286] | 40 | operator std::string () const { return name; }
|
---|
[94b1f718] | 41 | bool empty() const { return name.empty(); }
|
---|
[e0115286] | 42 | };
|
---|
[2bb4a01] | 43 |
|
---|
[e0115286] | 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; }
|
---|
[2bb4a01] | 47 |
|
---|
[e0115286] | 48 | inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; }
|
---|
| 49 |
|
---|
[2bb4a01] | 50 | }
|
---|
| 51 |
|
---|
| 52 | // Local Variables: //
|
---|
| 53 | // tab-width: 4 //
|
---|
| 54 | // mode: c++ //
|
---|
| 55 | // compile-command: "make install" //
|
---|
| 56 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.