Changes in src/AST/Decl.hpp [e67991f:312029a]
- File:
-
- 1 edited
-
src/AST/Decl.hpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
re67991f r312029a 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : Thu May 9 10:00:00 201913 // Update Count : 1 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 11 08:20:20 2019 13 // Update Count : 16 14 14 // 15 15 … … 154 154 155 155 /// Produces a name for the kind of alias 156 virtual std::stringtypeString() const = 0;156 virtual const char * typeString() const = 0; 157 157 158 158 private: … … 190 190 init( i ) {} 191 191 192 std::stringtypeString() const override;192 const char * typeString() const override; 193 193 /// Produces a name for generated code 194 std::stringgenTypeString() const;194 const char * genTypeString() const; 195 195 196 196 /// convenience accessor to match Type::isComplete() … … 212 212 : NamedTypeDecl( loc, name, storage, b, spec ) {} 213 213 214 std::stringtypeString() const override { return "typedef"; }214 const char * typeString() const override { return "typedef"; } 215 215 216 216 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } … … 223 223 class AggregateDecl : public Decl { 224 224 public: 225 enum Aggregate { Struct, Union, Enum, Exception, Trait, Generator, Coroutine, Monitor, Thread, NoAggregate }; 226 static const char * aggrString( Aggregate aggr ); 227 225 228 std::vector<ptr<Decl>> members; 226 229 std::vector<ptr<TypeDecl>> params; … … 237 240 238 241 /// Produces a name for the kind of aggregate 239 virtual std::stringtypeString() const = 0;242 virtual const char * typeString() const = 0; 240 243 241 244 private: … … 247 250 class StructDecl final : public AggregateDecl { 248 251 public: 249 DeclarationNode::Aggregate kind;252 Aggregate kind; 250 253 251 254 StructDecl( const CodeLocation& loc, const std::string& name, 252 DeclarationNode::Aggregate kind = DeclarationNode::Struct,255 Aggregate kind = Struct, 253 256 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 254 257 : AggregateDecl( loc, name, std::move(attrs), linkage ), kind( kind ) {} 255 258 256 bool is_coroutine() { return kind == DeclarationNode::Coroutine; }257 bool is_monitor() { return kind == DeclarationNode::Monitor; }258 bool is_thread() { return kind == DeclarationNode::Thread; }259 260 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 261 262 std::string typeString() const override { return "struct"; }259 bool is_coroutine() { return kind == Coroutine; } 260 bool is_monitor() { return kind == Monitor; } 261 bool is_thread() { return kind == Thread; } 262 263 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 264 265 const char * typeString() const override { return aggrString( kind ); } 263 266 264 267 private: … … 276 279 const Decl * accept( Visitor& v ) const override { return v.visit( this ); } 277 280 278 std::string typeString() const override { return "union"; }281 const char * typeString() const override { return aggrString( Union ); } 279 282 280 283 private: … … 295 298 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 296 299 297 std::string typeString() const override { return "enum"; }300 const char * typeString() const override { return aggrString( Enum ); } 298 301 299 302 private: … … 314 317 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 315 318 316 std::stringtypeString() const override { return "trait"; }319 const char * typeString() const override { return "trait"; } 317 320 318 321 private:
Note:
See TracChangeset
for help on using the changeset viewer.