[0dd3a2f] | 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 | // |
---|
[974906e2] | 7 | // Declaration.h -- |
---|
[0dd3a2f] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[fa4805f] | 11 | // Last Modified By : Andrew Beach |
---|
[6ea87486] | 12 | // Last Modified On : Fri Jul 14 16:59:00 2017 |
---|
| 13 | // Update Count : 123 |
---|
[0dd3a2f] | 14 | // |
---|
| 15 | |
---|
[51b7345] | 16 | #ifndef DECLARATION_H |
---|
| 17 | #define DECLARATION_H |
---|
| 18 | |
---|
[294647b] | 19 | #include <string> |
---|
| 20 | |
---|
| 21 | #include "BaseSyntaxNode.h" |
---|
[51b7345] | 22 | #include "Mutator.h" |
---|
[294647b] | 23 | #include "Visitor.h" |
---|
| 24 | #include "SynTree.h" |
---|
[51b7345] | 25 | #include "Parser/LinkageSpec.h" |
---|
[68cd1ce] | 26 | #include "Parser/ParseNode.h" |
---|
[51b7345] | 27 | |
---|
[294647b] | 28 | class Declaration : public BaseSyntaxNode { |
---|
[17cd4eb] | 29 | public: |
---|
[68fe077a] | 30 | Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ); |
---|
[0dd3a2f] | 31 | Declaration( const Declaration &other ); |
---|
| 32 | virtual ~Declaration(); |
---|
| 33 | |
---|
[5f2f2d7] | 34 | const std::string &get_name() const { return name; } |
---|
[0dd3a2f] | 35 | void set_name( std::string newValue ) { name = newValue; } |
---|
[a7c90d4] | 36 | |
---|
[68fe077a] | 37 | Type::StorageClasses get_storageClasses() const { return storageClasses; } |
---|
[a7c90d4] | 38 | |
---|
[8b7ee09] | 39 | LinkageSpec::Spec get_linkage() const { return linkage; } |
---|
| 40 | void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; } |
---|
[a7c90d4] | 41 | |
---|
[0dd3a2f] | 42 | UniqueId get_uniqueId() const { return uniqueId; } |
---|
[a7c90d4] | 43 | |
---|
[8e9cbb2] | 44 | bool get_extension() const { return extension; } |
---|
| 45 | Declaration *set_extension( bool exten ) { extension = exten; return this; } |
---|
[0dd3a2f] | 46 | |
---|
| 47 | void fixUniqueId( void ); |
---|
| 48 | virtual Declaration *clone() const = 0; |
---|
| 49 | virtual void accept( Visitor &v ) = 0; |
---|
| 50 | virtual Declaration *acceptMutator( Mutator &m ) = 0; |
---|
| 51 | virtual void print( std::ostream &os, int indent = 0 ) const = 0; |
---|
| 52 | virtual void printShort( std::ostream &os, int indent = 0 ) const = 0; |
---|
| 53 | |
---|
| 54 | static void dumpIds( std::ostream &os ); |
---|
| 55 | static Declaration *declFromId( UniqueId id ); |
---|
[17cd4eb] | 56 | private: |
---|
[0dd3a2f] | 57 | std::string name; |
---|
[68fe077a] | 58 | Type::StorageClasses storageClasses; |
---|
[8b7ee09] | 59 | LinkageSpec::Spec linkage; |
---|
[0dd3a2f] | 60 | UniqueId uniqueId; |
---|
[8e9cbb2] | 61 | bool extension = false; |
---|
[51b7345] | 62 | }; |
---|
| 63 | |
---|
[17cd4eb] | 64 | class DeclarationWithType : public Declaration { |
---|
| 65 | public: |
---|
[ddfd945] | 66 | DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs ); |
---|
[0dd3a2f] | 67 | DeclarationWithType( const DeclarationWithType &other ); |
---|
| 68 | virtual ~DeclarationWithType(); |
---|
[51b7345] | 69 | |
---|
[0dd3a2f] | 70 | std::string get_mangleName() const { return mangleName; } |
---|
[58dd019] | 71 | DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; } |
---|
[17cd4eb] | 72 | |
---|
[f326f99] | 73 | std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); } |
---|
| 74 | |
---|
| 75 | int get_scopeLevel() const { return scopeLevel; } |
---|
[58dd019] | 76 | DeclarationWithType * set_scopeLevel( int newValue ) { scopeLevel = newValue; return this; } |
---|
| 77 | |
---|
| 78 | ConstantExpr *get_asmName() const { return asmName; } |
---|
| 79 | DeclarationWithType * set_asmName( ConstantExpr *newValue ) { asmName = newValue; return this; } |
---|
[f326f99] | 80 | |
---|
[f9cebb5] | 81 | std::list< Attribute * >& get_attributes() { return attributes; } |
---|
| 82 | const std::list< Attribute * >& get_attributes() const { return attributes; } |
---|
| 83 | |
---|
[ddfd945] | 84 | Type::FuncSpecifiers get_funcSpec() const { return fs; } |
---|
| 85 | //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; } |
---|
[dd020c0] | 86 | |
---|
[0dd3a2f] | 87 | virtual DeclarationWithType *clone() const = 0; |
---|
| 88 | virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0; |
---|
[17cd4eb] | 89 | |
---|
[0dd3a2f] | 90 | virtual Type *get_type() const = 0; |
---|
| 91 | virtual void set_type(Type *) = 0; |
---|
[17cd4eb] | 92 | private: |
---|
[0dd3a2f] | 93 | // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2 |
---|
| 94 | std::string mangleName; |
---|
[58dd019] | 95 | // need to remember the scope level at which the variable was declared, so that shadowed identifiers can be accessed |
---|
[f326f99] | 96 | int scopeLevel = 0; |
---|
[f9cebb5] | 97 | |
---|
[58dd019] | 98 | ConstantExpr *asmName; |
---|
[f9cebb5] | 99 | std::list< Attribute * > attributes; |
---|
[ddfd945] | 100 | Type::FuncSpecifiers fs; |
---|
[51b7345] | 101 | }; |
---|
| 102 | |
---|
[17cd4eb] | 103 | class ObjectDecl : public DeclarationWithType { |
---|
[0dd3a2f] | 104 | typedef DeclarationWithType Parent; |
---|
[17cd4eb] | 105 | public: |
---|
[68fe077a] | 106 | ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, |
---|
[ddfd945] | 107 | const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); |
---|
[0dd3a2f] | 108 | ObjectDecl( const ObjectDecl &other ); |
---|
| 109 | virtual ~ObjectDecl(); |
---|
| 110 | |
---|
| 111 | virtual Type *get_type() const { return type; } |
---|
| 112 | virtual void set_type(Type *newType) { type = newType; } |
---|
| 113 | |
---|
| 114 | Initializer *get_init() const { return init; } |
---|
| 115 | void set_init( Initializer *newValue ) { init = newValue; } |
---|
[58dd019] | 116 | |
---|
[0dd3a2f] | 117 | Expression *get_bitfieldWidth() const { return bitfieldWidth; } |
---|
| 118 | void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; } |
---|
| 119 | |
---|
| 120 | virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); } |
---|
| 121 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
[1db21619] | 122 | virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[0dd3a2f] | 123 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 124 | virtual void printShort( std::ostream &os, int indent = 0 ) const; |
---|
[17cd4eb] | 125 | private: |
---|
[0dd3a2f] | 126 | Type *type; |
---|
| 127 | Initializer *init; |
---|
| 128 | Expression *bitfieldWidth; |
---|
[51b7345] | 129 | }; |
---|
| 130 | |
---|
[17cd4eb] | 131 | class FunctionDecl : public DeclarationWithType { |
---|
[0dd3a2f] | 132 | typedef DeclarationWithType Parent; |
---|
[17cd4eb] | 133 | public: |
---|
[68fe077a] | 134 | FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, |
---|
[ddfd945] | 135 | const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); |
---|
[0dd3a2f] | 136 | FunctionDecl( const FunctionDecl &other ); |
---|
| 137 | virtual ~FunctionDecl(); |
---|
[51b7345] | 138 | |
---|
[0dd3a2f] | 139 | Type *get_type() const; |
---|
| 140 | virtual void set_type(Type *); |
---|
[51b7345] | 141 | |
---|
[0dd3a2f] | 142 | FunctionType *get_functionType() const { return type; } |
---|
| 143 | void set_functionType( FunctionType *newValue ) { type = newValue; } |
---|
| 144 | CompoundStmt *get_statements() const { return statements; } |
---|
| 145 | void set_statements( CompoundStmt *newValue ) { statements = newValue; } |
---|
| 146 | |
---|
| 147 | virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } |
---|
| 148 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 149 | virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
| 150 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 151 | virtual void printShort( std::ostream &os, int indent = 0 ) const; |
---|
[17cd4eb] | 152 | private: |
---|
[0dd3a2f] | 153 | FunctionType *type; |
---|
| 154 | CompoundStmt *statements; |
---|
[51b7345] | 155 | }; |
---|
| 156 | |
---|
[17cd4eb] | 157 | class NamedTypeDecl : public Declaration { |
---|
[0dd3a2f] | 158 | typedef Declaration Parent; |
---|
[17cd4eb] | 159 | public: |
---|
[68fe077a] | 160 | NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type ); |
---|
[46f6134] | 161 | NamedTypeDecl( const NamedTypeDecl &other ); |
---|
[0dd3a2f] | 162 | virtual ~NamedTypeDecl(); |
---|
| 163 | |
---|
| 164 | Type *get_base() const { return base; } |
---|
| 165 | void set_base( Type *newValue ) { base = newValue; } |
---|
| 166 | std::list< TypeDecl* >& get_parameters() { return parameters; } |
---|
| 167 | std::list< DeclarationWithType* >& get_assertions() { return assertions; } |
---|
| 168 | |
---|
[e39241b] | 169 | virtual std::string typeString() const = 0; |
---|
| 170 | |
---|
[0dd3a2f] | 171 | virtual NamedTypeDecl *clone() const = 0; |
---|
| 172 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 173 | virtual void printShort( std::ostream &os, int indent = 0 ) const; |
---|
[17cd4eb] | 174 | protected: |
---|
| 175 | private: |
---|
[0dd3a2f] | 176 | Type *base; |
---|
| 177 | std::list< TypeDecl* > parameters; |
---|
| 178 | std::list< DeclarationWithType* > assertions; |
---|
[51b7345] | 179 | }; |
---|
| 180 | |
---|
[17cd4eb] | 181 | class TypeDecl : public NamedTypeDecl { |
---|
[0dd3a2f] | 182 | typedef NamedTypeDecl Parent; |
---|
[17cd4eb] | 183 | public: |
---|
[8f60f0b] | 184 | enum Kind { Any, Dtype, Ftype, Ttype }; |
---|
[2c57025] | 185 | /// Data extracted from a type decl |
---|
| 186 | struct Data { |
---|
| 187 | TypeDecl::Kind kind; |
---|
| 188 | bool isComplete; |
---|
| 189 | Data() : kind( (TypeDecl::Kind)-1 ), isComplete( false ) {} |
---|
| 190 | Data( TypeDecl * typeDecl ) : Data( typeDecl->get_kind(), typeDecl->isComplete() ) {} |
---|
| 191 | Data( Kind kind, bool isComplete ) : kind( kind ), isComplete( isComplete ) {} |
---|
| 192 | bool operator==(const Data & other) const { return kind == other.kind && isComplete == other.isComplete; } |
---|
| 193 | bool operator!=(const Data & other) const { return !(*this == other);} |
---|
| 194 | }; |
---|
[51b7345] | 195 | |
---|
[67cf18c] | 196 | TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init = nullptr ); |
---|
[0dd3a2f] | 197 | TypeDecl( const TypeDecl &other ); |
---|
[67cf18c] | 198 | virtual ~TypeDecl(); |
---|
[17cd4eb] | 199 | |
---|
[0dd3a2f] | 200 | Kind get_kind() const { return kind; } |
---|
[51b7345] | 201 | |
---|
[67cf18c] | 202 | Type * get_init() const { return init; } |
---|
| 203 | TypeDecl * set_init( Type * newValue ) { init = newValue; return this; } |
---|
| 204 | |
---|
[2c57025] | 205 | bool isComplete() const { return kind == Any || sized; } |
---|
| 206 | bool get_sized() const { return sized; } |
---|
| 207 | TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; } |
---|
| 208 | |
---|
[e39241b] | 209 | virtual std::string typeString() const; |
---|
[bdd0755] | 210 | virtual std::string genTypeString() const; |
---|
[e39241b] | 211 | |
---|
[0dd3a2f] | 212 | virtual TypeDecl *clone() const { return new TypeDecl( *this ); } |
---|
| 213 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 214 | virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[67cf18c] | 215 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 216 | |
---|
[17cd4eb] | 217 | private: |
---|
[0dd3a2f] | 218 | Kind kind; |
---|
[67cf18c] | 219 | Type * init; |
---|
[2c57025] | 220 | bool sized; |
---|
[51b7345] | 221 | }; |
---|
| 222 | |
---|
[17cd4eb] | 223 | class TypedefDecl : public NamedTypeDecl { |
---|
[0dd3a2f] | 224 | typedef NamedTypeDecl Parent; |
---|
[17cd4eb] | 225 | public: |
---|
[68fe077a] | 226 | TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {} |
---|
[0dd3a2f] | 227 | TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} |
---|
[17cd4eb] | 228 | |
---|
[e39241b] | 229 | virtual std::string typeString() const; |
---|
| 230 | |
---|
[0dd3a2f] | 231 | virtual TypedefDecl *clone() const { return new TypedefDecl( *this ); } |
---|
| 232 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 233 | virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[17cd4eb] | 234 | private: |
---|
[51b7345] | 235 | }; |
---|
| 236 | |
---|
[17cd4eb] | 237 | class AggregateDecl : public Declaration { |
---|
[0dd3a2f] | 238 | typedef Declaration Parent; |
---|
[17cd4eb] | 239 | public: |
---|
[fa4805f] | 240 | AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); |
---|
[0dd3a2f] | 241 | AggregateDecl( const AggregateDecl &other ); |
---|
| 242 | virtual ~AggregateDecl(); |
---|
[51b7345] | 243 | |
---|
[0dd3a2f] | 244 | std::list<Declaration*>& get_members() { return members; } |
---|
| 245 | std::list<TypeDecl*>& get_parameters() { return parameters; } |
---|
[17cd4eb] | 246 | |
---|
[c0aa336] | 247 | std::list< Attribute * >& get_attributes() { return attributes; } |
---|
| 248 | const std::list< Attribute * >& get_attributes() const { return attributes; } |
---|
| 249 | |
---|
[5d125e4] | 250 | bool has_body() const { return body; } |
---|
| 251 | AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; } |
---|
| 252 | |
---|
[0dd3a2f] | 253 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 254 | virtual void printShort( std::ostream &os, int indent = 0 ) const; |
---|
[17cd4eb] | 255 | protected: |
---|
[0dd3a2f] | 256 | virtual std::string typeString() const = 0; |
---|
[17cd4eb] | 257 | |
---|
| 258 | private: |
---|
[0dd3a2f] | 259 | std::list<Declaration*> members; |
---|
| 260 | std::list<TypeDecl*> parameters; |
---|
[5d125e4] | 261 | bool body; |
---|
[c0aa336] | 262 | std::list< Attribute * > attributes; |
---|
[51b7345] | 263 | }; |
---|
| 264 | |
---|
[17cd4eb] | 265 | class StructDecl : public AggregateDecl { |
---|
[0dd3a2f] | 266 | typedef AggregateDecl Parent; |
---|
[17cd4eb] | 267 | public: |
---|
[6ea87486] | 268 | StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {} |
---|
| 269 | StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {} |
---|
[0dd3a2f] | 270 | StructDecl( const StructDecl &other ) : Parent( other ) {} |
---|
[17cd4eb] | 271 | |
---|
[409433da] | 272 | bool is_coroutine() { return kind == DeclarationNode::Coroutine; } |
---|
| 273 | bool is_monitor() { return kind == DeclarationNode::Monitor; } |
---|
| 274 | bool is_thread() { return kind == DeclarationNode::Thread; } |
---|
| 275 | |
---|
[6ea87486] | 276 | // Tagged/Tree Structure Excetion |
---|
| 277 | bool get_tagged() { return tagged; } |
---|
| 278 | void set_tagged( bool newValue ) { tagged = newValue; } |
---|
| 279 | bool has_parent() { return parent_name != ""; } |
---|
| 280 | std::string get_parentName() { return parent_name; } |
---|
| 281 | |
---|
[0dd3a2f] | 282 | virtual StructDecl *clone() const { return new StructDecl( *this ); } |
---|
| 283 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 284 | virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[17cd4eb] | 285 | private: |
---|
[409433da] | 286 | DeclarationNode::Aggregate kind; |
---|
[0dd3a2f] | 287 | virtual std::string typeString() const; |
---|
[6ea87486] | 288 | |
---|
| 289 | bool tagged; |
---|
| 290 | std::string parent_name; |
---|
[51b7345] | 291 | }; |
---|
| 292 | |
---|
[17cd4eb] | 293 | class UnionDecl : public AggregateDecl { |
---|
[0dd3a2f] | 294 | typedef AggregateDecl Parent; |
---|
[17cd4eb] | 295 | public: |
---|
[fa4805f] | 296 | UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} |
---|
[0dd3a2f] | 297 | UnionDecl( const UnionDecl &other ) : Parent( other ) {} |
---|
[17cd4eb] | 298 | |
---|
[0dd3a2f] | 299 | virtual UnionDecl *clone() const { return new UnionDecl( *this ); } |
---|
| 300 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 301 | virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[17cd4eb] | 302 | private: |
---|
[0dd3a2f] | 303 | virtual std::string typeString() const; |
---|
[51b7345] | 304 | }; |
---|
| 305 | |
---|
[17cd4eb] | 306 | class EnumDecl : public AggregateDecl { |
---|
[0dd3a2f] | 307 | typedef AggregateDecl Parent; |
---|
[17cd4eb] | 308 | public: |
---|
[fa4805f] | 309 | EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} |
---|
[0dd3a2f] | 310 | EnumDecl( const EnumDecl &other ) : Parent( other ) {} |
---|
[17cd4eb] | 311 | |
---|
[0dd3a2f] | 312 | virtual EnumDecl *clone() const { return new EnumDecl( *this ); } |
---|
| 313 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 314 | virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[17cd4eb] | 315 | private: |
---|
[0dd3a2f] | 316 | virtual std::string typeString() const; |
---|
[51b7345] | 317 | }; |
---|
| 318 | |
---|
[4040425] | 319 | class TraitDecl : public AggregateDecl { |
---|
[0dd3a2f] | 320 | typedef AggregateDecl Parent; |
---|
[17cd4eb] | 321 | public: |
---|
[c0aa336] | 322 | TraitDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name ) { |
---|
| 323 | assertf( attributes.empty(), "attribute unsupported for traits" ); |
---|
| 324 | } |
---|
[4040425] | 325 | TraitDecl( const TraitDecl &other ) : Parent( other ) {} |
---|
[17cd4eb] | 326 | |
---|
[4040425] | 327 | virtual TraitDecl *clone() const { return new TraitDecl( *this ); } |
---|
[0dd3a2f] | 328 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 329 | virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
[17cd4eb] | 330 | private: |
---|
[0dd3a2f] | 331 | virtual std::string typeString() const; |
---|
[51b7345] | 332 | }; |
---|
| 333 | |
---|
[e994912] | 334 | class AsmDecl : public Declaration { |
---|
| 335 | public: |
---|
| 336 | AsmDecl( AsmStmt *stmt ); |
---|
| 337 | AsmDecl( const AsmDecl &other ); |
---|
| 338 | virtual ~AsmDecl(); |
---|
| 339 | |
---|
| 340 | AsmStmt *get_stmt() { return stmt; } |
---|
| 341 | void set_stmt( AsmStmt *newValue ) { stmt = newValue; } |
---|
| 342 | |
---|
| 343 | virtual AsmDecl *clone() const { return new AsmDecl( *this ); } |
---|
| 344 | virtual void accept( Visitor &v ) { v.visit( this ); } |
---|
| 345 | virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } |
---|
| 346 | virtual void print( std::ostream &os, int indent = 0 ) const; |
---|
| 347 | virtual void printShort( std::ostream &os, int indent = 0 ) const; |
---|
| 348 | private: |
---|
| 349 | AsmStmt *stmt; |
---|
| 350 | }; |
---|
| 351 | |
---|
[3906301] | 352 | std::ostream & operator<<( std::ostream & out, const Declaration * decl ); |
---|
[2c57025] | 353 | std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); |
---|
[baf7fee] | 354 | |
---|
[17cd4eb] | 355 | #endif // DECLARATION_H |
---|
[0dd3a2f] | 356 | |
---|
| 357 | // Local Variables: // |
---|
| 358 | // tab-width: 4 // |
---|
| 359 | // mode: c++ // |
---|
| 360 | // compile-command: "make install" // |
---|
| 361 | // End: // |
---|