source: src/AST/Attribute.hpp @ 0588d8c

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 0588d8c was 87701b6, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Tentative fix for increment/decrement and implented a few more visits

  • Property mode set to 100644
File size: 1.4 KB
Line 
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
21#include "Fwd.hpp"
22#include "Node.hpp"     // for ptr
23#include "Visitor.hpp"
24
25namespace ast {
26
27class Expr;
28
29class Attribute final : public Node {
30public:
31        std::string name;
32        std::vector<ptr<Expr>> parameters;
33
34        Attribute( const std::string & name = "", std::vector<ptr<Expr>> && params = {})
35        : name( name ), parameters( params ) {}
36        virtual ~Attribute() = default;
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
46        const Attribute * accept( Visitor & v ) const override { return v.visit( this ); }
47private:
48        Attribute * clone() const override { return new Attribute{ *this }; }
49
50        /// Must be copied in ALL derived classes
51        template<typename node_t>
52        friend node_t * mutate(const node_t * node);
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.