source: src/AST/Attribute.hpp @ 8bea701

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 8bea701 was 99da267, checked in by Michael Brooks <mlbrooks@…>, 5 years ago

Running a deep-copy on FunctionType? at RenameVars? time. This manual action addresses the currently-problematic occurrence of 'the transitivity problem.' Resolution of bootloader (and thus builtins) is now completing. The change on RenameVars?.cc makes this happen. Changes on AST/*.hpp finish making the deep-copy framework compile.

  • Property mode set to 100644
File size: 1.5 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>> params;
33
34        Attribute( const std::string & name = "", std::vector<ptr<Expr>> && params = {})
35        : name( name ), params( 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        template<typename node_t>
54    friend node_t * shallowCopy(const node_t * node);
55};
56
57}
58
59// Local Variables: //
60// tab-width: 4 //
61// mode: c++ //
62// compile-command: "make install" //
63// End: //
Note: See TracBrowser for help on using the repository browser.