Changes in src/SynTree/Declaration.h [58dd019:2c57025]
- File:
-
- 1 edited
-
src/SynTree/Declaration.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
r58dd019 r2c57025 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Dec 13 13:37:33201613 // Update Count : 4 912 // Last Modified On : Thu Aug 18 23:50:24 2016 13 // Update Count : 40 14 14 // 15 15 … … 69 69 70 70 std::string get_mangleName() const { return mangleName; } 71 DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; }71 void set_mangleName( std::string newValue ) { mangleName = newValue; } 72 72 73 73 std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); } 74 74 75 75 int get_scopeLevel() const { return scopeLevel; } 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; } 76 void set_scopeLevel( int newValue ) { scopeLevel = newValue; } 80 77 81 78 std::list< Attribute * >& get_attributes() { return attributes; } … … 90 87 // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2 91 88 std::string mangleName; 92 // need to remember the scope level at which the variable was declared, so that shadowed identifiers can be accessed 89 // need to remember the scope level at which the variable was declared, so that 90 // shadowed identifiers can be accessed 93 91 int scopeLevel = 0; 94 92 95 ConstantExpr *asmName;96 93 std::list< Attribute * > attributes; 97 94 }; … … 109 106 Initializer *get_init() const { return init; } 110 107 void set_init( Initializer *newValue ) { init = newValue; } 111 112 108 Expression *get_bitfieldWidth() const { return bitfieldWidth; } 113 109 void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; } … … 180 176 public: 181 177 enum Kind { Any, Dtype, Ftype }; 178 /// Data extracted from a type decl 179 struct Data { 180 TypeDecl::Kind kind; 181 bool isComplete; 182 Data() : kind( (TypeDecl::Kind)-1 ), isComplete( false ) {} 183 Data( TypeDecl * typeDecl ) : Data( typeDecl->get_kind(), typeDecl->isComplete() ) {} 184 Data( Kind kind, bool isComplete ) : kind( kind ), isComplete( isComplete ) {} 185 bool operator==(const Data & other) const { return kind == other.kind && isComplete == other.isComplete; } 186 bool operator!=(const Data & other) const { return !(*this == other);} 187 }; 182 188 183 189 TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ); … … 186 192 Kind get_kind() const { return kind; } 187 193 194 bool isComplete() const { return kind == Any || sized; } 195 bool get_sized() const { return sized; } 196 TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; } 197 188 198 virtual TypeDecl *clone() const { return new TypeDecl( *this ); } 189 199 virtual void accept( Visitor &v ) { v.visit( this ); } … … 192 202 virtual std::string typeString() const; 193 203 Kind kind; 204 bool sized; 194 205 }; 195 206 … … 284 295 285 296 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 297 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 286 298 287 299 #endif // DECLARATION_H
Note:
See TracChangeset
for help on using the changeset viewer.