Changeset ddfd945 for src/SynTree
- Timestamp:
- Mar 16, 2017, 8:47:36 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- fb04321
- Parents:
- 26ba208
- Location:
- src/SynTree
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SynTree/Declaration.h ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:48:23201713 // Update Count : 11 712 // Last Modified On : Thu Mar 16 08:34:11 2017 13 // Update Count : 118 14 14 // 15 15 … … 64 64 class DeclarationWithType : public Declaration { 65 65 public: 66 DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );66 DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs ); 67 67 DeclarationWithType( const DeclarationWithType &other ); 68 68 virtual ~DeclarationWithType(); … … 82 82 const std::list< Attribute * >& get_attributes() const { return attributes; } 83 83 84 DeclarationNode::FuncSpecifiers get_funcSpec() const { return fs; }85 //void set_functionSpecifiers( DeclarationNode::FuncSpecifiers newValue ) { fs = newValue; }84 Type::FuncSpecifiers get_funcSpec() const { return fs; } 85 //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; } 86 86 87 87 virtual DeclarationWithType *clone() const = 0; … … 98 98 ConstantExpr *asmName; 99 99 std::list< Attribute * > attributes; 100 DeclarationNode::FuncSpecifiers fs;100 Type::FuncSpecifiers fs; 101 101 }; 102 102 … … 105 105 public: 106 106 ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, 107 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );107 const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); 108 108 ObjectDecl( const ObjectDecl &other ); 109 109 virtual ~ObjectDecl(); … … 133 133 public: 134 134 FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, 135 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );135 const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); 136 136 FunctionDecl( const FunctionDecl &other ); 137 137 virtual ~FunctionDecl(); -
TabularUnified src/SynTree/DeclarationWithType.cc ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:49:27201713 // Update Count : 2 412 // Last Modified On : Thu Mar 16 08:34:35 2017 13 // Update Count : 25 14 14 // 15 15 … … 19 19 #include "Common/utility.h" 20 20 21 DeclarationWithType::DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )21 DeclarationWithType::DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs ) 22 22 : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) { 23 23 } -
TabularUnified src/SynTree/FunctionDecl.cc ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:49:35201713 // Update Count : 7 312 // Last Modified On : Thu Mar 16 08:33:41 2017 13 // Update Count : 74 14 14 // 15 15 … … 26 26 extern bool translation_unit_nomain; 27 27 28 FunctionDecl::FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )28 FunctionDecl::FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, Type::FuncSpecifiers fs ) 29 29 : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) { 30 30 // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern -
TabularUnified src/SynTree/ObjectDecl.cc ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:49:51201713 // Update Count : 5 812 // Last Modified On : Thu Mar 16 08:34:27 2017 13 // Update Count : 59 14 14 // 15 15 … … 22 22 #include "Statement.h" 23 23 24 ObjectDecl::ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )24 ObjectDecl::ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, Type::FuncSpecifiers fs ) 25 25 : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 26 26 } -
TabularUnified src/SynTree/Type.cc ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:57:45201713 // Update Count : 2 012 // Last Modified On : Thu Mar 16 08:32:44 2017 13 // Update Count : 22 14 14 // 15 15 … … 60 60 61 61 // These must remain in the same order as the corresponding bit fields. 62 const char * Type::FuncSpecifiers::Names[] = { "inline", "fortran", "_Noreturn" }; 62 63 const char * Type::StorageClasses::Names[] = { "extern", "static", "auto", "register", "_Thread_local" }; 63 64 const char * Type::Qualifiers::Names[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" }; -
TabularUnified src/SynTree/Type.h ¶
r26ba208 rddfd945 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 0 7:45:29201713 // Update Count : 9 012 // Last Modified On : Thu Mar 16 08:28:02 2017 13 // Update Count : 91 14 14 // 15 15 … … 25 25 public: 26 26 // enum must remain in the same order as the corresponding bit fields. 27 28 enum { Inline = 1 << 0, Noreturn = 1 << 1, Fortran = 1 << 2, NumFuncSpecifier = 3 }; 29 union FuncSpecifiers { 30 static const char * Names[]; 31 unsigned int val; 32 struct { 33 bool is_inline : 1; 34 bool is_noreturn : 1; 35 bool is_fortran : 1; 36 }; 37 FuncSpecifiers() : val( 0 ) {} 38 FuncSpecifiers( unsigned int val ) : val( val ) {} 39 bool operator[]( unsigned int i ) const { return val & (1 << i); } 40 bool any() const { return val != 0; } 41 void print( std::ostream & os ) const { 42 if ( (*this).any() ) { // any function specifiers ? 43 for ( unsigned int i = 0; i < NumFuncSpecifier; i += 1 ) { 44 if ( (*this)[i] ) { 45 os << FuncSpecifiers::Names[i] << ' '; 46 } // if 47 } // for 48 } // if 49 } 50 }; // FuncSpecifiers 27 51 28 52 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 };
Note: See TracChangeset
for help on using the changeset viewer.