ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 04b73b6 was
489bacf,
checked in by Aaron Moss <a3moss@…>, 5 years ago
|
Changed Attribute field to params
Done for consistency with other field names.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[7e89526] | 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 | // Attribute.hpp -- |
---|
| 8 | // |
---|
| 9 | // Author : Aaron B. Moss |
---|
| 10 | // Created On : Fri May 10 10:30:00 2019 |
---|
| 11 | // Last Modified By : Aaron B. Moss |
---|
| 12 | // Created On : Fri May 10 10:30:00 2019 |
---|
| 13 | // Update Count : 1 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #pragma once |
---|
| 17 | |
---|
| 18 | #include <string> |
---|
| 19 | #include <vector> |
---|
| 20 | |
---|
[6d51bd7] | 21 | #include "Fwd.hpp" |
---|
[7e89526] | 22 | #include "Node.hpp" // for ptr |
---|
| 23 | #include "Visitor.hpp" |
---|
| 24 | |
---|
| 25 | namespace ast { |
---|
| 26 | |
---|
| 27 | class Expr; |
---|
| 28 | |
---|
| 29 | class Attribute final : public Node { |
---|
| 30 | public: |
---|
| 31 | std::string name; |
---|
[489bacf] | 32 | std::vector<ptr<Expr>> params; |
---|
[7e89526] | 33 | |
---|
[6d51bd7] | 34 | Attribute( const std::string & name = "", std::vector<ptr<Expr>> && params = {}) |
---|
[489bacf] | 35 | : name( name ), params( params ) {} |
---|
[6d51bd7] | 36 | virtual ~Attribute() = default; |
---|
[7e89526] | 37 | |
---|
| 38 | bool empty() const { return name.empty(); } |
---|
| 39 | |
---|
| 40 | /// strip leading/trailing underscores and lowercase |
---|
| 41 | std::string normalizedName() const; |
---|
| 42 | |
---|
| 43 | /// true iff this attribute is allowed to appear attached to a function parameter |
---|
| 44 | bool isValidOnFuncParam() const; |
---|
| 45 | |
---|
[6d51bd7] | 46 | const Attribute * accept( Visitor & v ) const override { return v.visit( this ); } |
---|
[7e89526] | 47 | private: |
---|
[6d51bd7] | 48 | Attribute * clone() const override { return new Attribute{ *this }; } |
---|
| 49 | |
---|
| 50 | /// Must be copied in ALL derived classes |
---|
| 51 | template<typename node_t> |
---|
[87701b6] | 52 | friend node_t * mutate(const node_t * node); |
---|
[7e89526] | 53 | }; |
---|
| 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | // Local Variables: // |
---|
| 58 | // tab-width: 4 // |
---|
| 59 | // mode: c++ // |
---|
| 60 | // compile-command: "make install" // |
---|
| 61 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.