Changes in src/SynTree/Declaration.h [f0ecf9b:e3e16bc]
- File:
-
- 1 edited
-
src/SynTree/Declaration.h (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
rf0ecf9b re3e16bc 61 61 62 62 void fixUniqueId( void ); 63 virtual Declaration *clone() const override= 0;64 virtual void accept( Visitor &v ) override= 0;65 virtual Declaration *acceptMutator( Mutator &m ) override= 0;66 virtual void print( std::ostream &os, Indenter indent = {} ) const override= 0;67 virtual void printShort( std::ostream &os, Indenter indent = {}) const = 0;63 virtual Declaration *clone() const = 0; 64 virtual void accept( Visitor &v ) = 0; 65 virtual Declaration *acceptMutator( Mutator &m ) = 0; 66 virtual void print( std::ostream &os, int indent = 0 ) const = 0; 67 virtual void printShort( std::ostream &os, int indent = 0 ) const = 0; 68 68 69 69 static void dumpIds( std::ostream &os ); … … 106 106 //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; } 107 107 108 virtual DeclarationWithType *clone() const override= 0;109 virtual DeclarationWithType *acceptMutator( Mutator &m ) override= 0;108 virtual DeclarationWithType *clone() const = 0; 109 virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0; 110 110 111 111 virtual Type * get_type() const = 0; … … 128 128 virtual ~ObjectDecl(); 129 129 130 virtual Type * get_type() const override{ return type; }131 virtual void set_type(Type *newType) override{ type = newType; }130 virtual Type * get_type() const { return type; } 131 virtual void set_type(Type *newType) { type = newType; } 132 132 133 133 Initializer *get_init() const { return init; } … … 137 137 void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; } 138 138 139 static ObjectDecl * newObject( const std::string & name, Type * type, Initializer * init ); 140 141 virtual ObjectDecl *clone() const override { return new ObjectDecl( *this ); } 142 virtual void accept( Visitor &v ) override { v.visit( this ); } 143 virtual DeclarationWithType *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 144 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 145 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override; 139 virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); } 140 virtual void accept( Visitor &v ) { v.visit( this ); } 141 virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); } 142 virtual void print( std::ostream &os, int indent = 0 ) const; 143 virtual void printShort( std::ostream &os, int indent = 0 ) const; 146 144 }; 147 145 … … 157 155 virtual ~FunctionDecl(); 158 156 159 virtual Type * get_type() const override{ return type; }160 virtual void set_type(Type * t) override{ type = strict_dynamic_cast< FunctionType* >( t ); }157 Type * get_type() const { return type; } 158 virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); } 161 159 162 160 FunctionType * get_functionType() const { return type; } … … 165 163 void set_statements( CompoundStmt *newValue ) { statements = newValue; } 166 164 167 static FunctionDecl * newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements ); 168 169 virtual FunctionDecl *clone() const override { return new FunctionDecl( *this ); } 170 virtual void accept( Visitor &v ) override { v.visit( this ); } 171 virtual DeclarationWithType *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 172 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 173 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override; 165 virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } 166 virtual void accept( Visitor &v ) { v.visit( this ); } 167 virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); } 168 virtual void print( std::ostream &os, int indent = 0 ) const; 169 virtual void printShort( std::ostream &os, int indent = 0 ) const; 174 170 }; 175 171 … … 192 188 virtual std::string typeString() const = 0; 193 189 194 virtual NamedTypeDecl *clone() const override= 0;195 virtual void print( std::ostream &os, Indenter indent = {} ) const override;196 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;190 virtual NamedTypeDecl *clone() const = 0; 191 virtual void print( std::ostream &os, int indent = 0 ) const; 192 virtual void printShort( std::ostream &os, int indent = 0 ) const; 197 193 }; 198 194 … … 200 196 typedef NamedTypeDecl Parent; 201 197 public: 202 enum Kind { Dtype, Ftype, Ttype };198 enum Kind { Any, Dtype, Ftype, Ttype }; 203 199 204 200 Type * init; … … 216 212 }; 217 213 218 TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, bool sized,Type * init = nullptr );214 TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init = nullptr ); 219 215 TypeDecl( const TypeDecl &other ); 220 216 virtual ~TypeDecl(); … … 225 221 TypeDecl * set_init( Type * newValue ) { init = newValue; return this; } 226 222 227 bool isComplete() const { return sized; }223 bool isComplete() const { return kind == Any || sized; } 228 224 bool get_sized() const { return sized; } 229 225 TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; } 230 226 231 virtual std::string typeString() const override;227 virtual std::string typeString() const; 232 228 virtual std::string genTypeString() const; 233 229 234 virtual TypeDecl *clone() const override{ return new TypeDecl( *this ); }235 virtual void accept( Visitor &v ) override{ v.visit( this ); }236 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }237 virtual void print( std::ostream &os, Indenter indent = {} ) const override;230 virtual TypeDecl *clone() const { return new TypeDecl( *this ); } 231 virtual void accept( Visitor &v ) { v.visit( this ); } 232 virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } 233 virtual void print( std::ostream &os, int indent = 0 ) const; 238 234 239 235 private: … … 247 243 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 248 244 249 virtual std::string typeString() const override;250 251 virtual TypedefDecl *clone() const override{ return new TypedefDecl( *this ); }252 virtual void accept( Visitor &v ) override{ v.visit( this ); }253 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }245 virtual std::string typeString() const; 246 247 virtual TypedefDecl *clone() const { return new TypedefDecl( *this ); } 248 virtual void accept( Visitor &v ) { v.visit( this ); } 249 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 254 250 private: 255 251 }; … … 276 272 AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; } 277 273 278 virtual void print( std::ostream &os, Indenter indent = {} ) const override;279 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;274 virtual void print( std::ostream &os, int indent = 0 ) const; 275 virtual void printShort( std::ostream &os, int indent = 0 ) const; 280 276 protected: 281 277 virtual std::string typeString() const = 0; … … 292 288 bool is_thread() { return kind == DeclarationNode::Thread; } 293 289 294 virtual StructDecl *clone() const override{ return new StructDecl( *this ); }295 virtual void accept( Visitor &v ) override{ v.visit( this ); }296 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }290 virtual StructDecl *clone() const { return new StructDecl( *this ); } 291 virtual void accept( Visitor &v ) { v.visit( this ); } 292 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 297 293 private: 298 294 DeclarationNode::Aggregate kind; 299 virtual std::string typeString() const override;295 virtual std::string typeString() const; 300 296 }; 301 297 … … 306 302 UnionDecl( const UnionDecl &other ) : Parent( other ) {} 307 303 308 virtual UnionDecl *clone() const override{ return new UnionDecl( *this ); }309 virtual void accept( Visitor &v ) override{ v.visit( this ); }310 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }311 private: 312 virtual std::string typeString() const override;304 virtual UnionDecl *clone() const { return new UnionDecl( *this ); } 305 virtual void accept( Visitor &v ) { v.visit( this ); } 306 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 307 private: 308 virtual std::string typeString() const; 313 309 }; 314 310 … … 319 315 EnumDecl( const EnumDecl &other ) : Parent( other ) {} 320 316 321 virtual EnumDecl *clone() const override{ return new EnumDecl( *this ); }322 virtual void accept( Visitor &v ) override{ v.visit( this ); }323 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }324 private: 325 virtual std::string typeString() const override;317 virtual EnumDecl *clone() const { return new EnumDecl( *this ); } 318 virtual void accept( Visitor &v ) { v.visit( this ); } 319 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 320 private: 321 virtual std::string typeString() const; 326 322 }; 327 323 … … 334 330 TraitDecl( const TraitDecl &other ) : Parent( other ) {} 335 331 336 virtual TraitDecl *clone() const override{ return new TraitDecl( *this ); }337 virtual void accept( Visitor &v ) override{ v.visit( this ); }338 virtual Declaration *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }339 private: 340 virtual std::string typeString() const override;332 virtual TraitDecl *clone() const { return new TraitDecl( *this ); } 333 virtual void accept( Visitor &v ) { v.visit( this ); } 334 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 335 private: 336 virtual std::string typeString() const; 341 337 }; 342 338 … … 352 348 void set_stmt( AsmStmt *newValue ) { stmt = newValue; } 353 349 354 virtual AsmDecl *clone() const override { return new AsmDecl( *this ); } 355 virtual void accept( Visitor &v ) override { v.visit( this ); } 356 virtual AsmDecl *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 357 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 358 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override; 359 }; 360 350 virtual AsmDecl *clone() const { return new AsmDecl( *this ); } 351 virtual void accept( Visitor &v ) { v.visit( this ); } 352 virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } 353 virtual void print( std::ostream &os, int indent = 0 ) const; 354 virtual void printShort( std::ostream &os, int indent = 0 ) const; 355 }; 356 357 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 361 358 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 362 359
Note:
See TracChangeset
for help on using the changeset viewer.