Changeset 8b7ee09
- Timestamp:
- Aug 19, 2016, 8:57:22 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ac71a86, e6955b1
- Parents:
- f487962
- Location:
- src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Assert.cc
rf487962 r8b7ee09 10 10 // Created On : Thu Aug 18 13:26:59 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 16:32:47201613 // Update Count : 712 // Last Modified On : Thu Aug 18 23:40:29 2016 13 // Update Count : 8 14 14 // 15 16 15 17 16 #include <assert.h> -
src/Common/CompilerError.h
rf487962 r8b7ee09 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 May 19 07:20:37 201513 // Update Count : 212 // Last Modified On : Thu Aug 18 23:41:30 2016 13 // Update Count : 3 14 14 // 15 15 … … 18 18 19 19 #include <string> 20 //#include "../config.h"21 20 22 21 class CompilerError : public std::exception { -
src/Parser/DeclarationNode.cc
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 23:14:51201613 // Update Count : 18 112 // Last Modified On : Thu Aug 18 23:48:23 2016 13 // Update Count : 182 14 14 // 15 15 … … 41 41 UniqueName DeclarationNode::anonymous( "__anonymous" ); 42 42 43 extern LinkageSpec:: Typelinkage; // defined in parser.yy43 extern LinkageSpec::Spec linkage; // defined in parser.yy 44 44 45 45 DeclarationNode *DeclarationNode::clone() const { -
src/Parser/LinkageSpec.cc
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 13:22:09 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 23:02:37201613 // Update Count : 1 112 // Last Modified On : Thu Aug 18 23:47:14 2016 13 // Update Count : 12 14 14 // 15 15 … … 20 20 #include "Common/SemanticError.h" 21 21 22 LinkageSpec:: TypeLinkageSpec::fromString( const std::string &stringSpec ) {22 LinkageSpec::Spec LinkageSpec::fromString( const std::string &stringSpec ) { 23 23 if ( stringSpec == "\"Cforall\"" ) { 24 24 return Cforall; … … 30 30 } 31 31 32 std::string LinkageSpec::toString( LinkageSpec:: Typelinkage ) {33 static const char *linkageKinds[LinkageSpec::NoOf Types] = {32 std::string LinkageSpec::toString( LinkageSpec::Spec linkage ) { 33 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = { 34 34 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", 35 35 }; … … 37 37 } 38 38 39 bool LinkageSpec::isDecoratable( Typet ) {40 static bool decoratable[LinkageSpec::NoOf Types] = {39 bool LinkageSpec::isDecoratable( Spec t ) { 40 static bool decoratable[LinkageSpec::NoOfSpecs] = { 41 41 // Intrinsic, Cforall, C, AutoGen, Compiler 42 42 true, true, false, true, false, 43 43 }; 44 return decoratable[ t];44 return decoratable[t]; 45 45 } 46 46 47 bool LinkageSpec::isGeneratable( Typet ) {48 static bool generatable[LinkageSpec::NoOf Types] = {47 bool LinkageSpec::isGeneratable( Spec t ) { 48 static bool generatable[LinkageSpec::NoOfSpecs] = { 49 49 // Intrinsic, Cforall, C, AutoGen, Compiler 50 50 true, true, true, true, false, 51 51 }; 52 return generatable[ t];52 return generatable[t]; 53 53 } 54 54 55 bool LinkageSpec::isOverloadable( Typet ) {55 bool LinkageSpec::isOverloadable( Spec t ) { 56 56 return isDecoratable( t ); 57 57 } 58 58 59 59 60 bool LinkageSpec::isOverridable( Typet ) {61 static bool overridable[LinkageSpec::NoOf Types] = {60 bool LinkageSpec::isOverridable( Spec t ) { 61 static bool overridable[LinkageSpec::NoOfSpecs] = { 62 62 // Intrinsic, Cforall, C, AutoGen, Compiler 63 63 true, false, false, true, false, 64 64 }; 65 return overridable[ t];65 return overridable[t]; 66 66 } 67 67 68 bool LinkageSpec::isBuiltin( Typet ) {69 static bool builtin[LinkageSpec::NoOf Types] = {68 bool LinkageSpec::isBuiltin( Spec t ) { 69 static bool builtin[LinkageSpec::NoOfSpecs] = { 70 70 // Intrinsic, Cforall, C, AutoGen, Compiler 71 71 true, false, false, false, true, 72 72 }; 73 return builtin[ t];73 return builtin[t]; 74 74 } 75 75 -
src/Parser/LinkageSpec.h
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 13:24:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 22:19:48201613 // Update Count : 612 // Last Modified On : Thu Aug 18 23:47:16 2016 13 // Update Count : 7 14 14 // 15 15 … … 20 20 21 21 struct LinkageSpec { 22 enum Type{22 enum Spec { 23 23 Intrinsic, // C built-in defined in prelude 24 24 Cforall, // ordinary … … 26 26 AutoGen, // built by translator (struct assignment) 27 27 Compiler, // gcc internal 28 NoOf Types28 NoOfSpecs 29 29 }; 30 30 31 static TypefromString( const std::string & );32 static std::string toString( Type);31 static Spec fromString( const std::string & ); 32 static std::string toString( Spec ); 33 33 34 static bool isDecoratable( Type);35 static bool isGeneratable( Type);36 static bool isOverloadable( Type);37 static bool isOverridable( Type);38 static bool isBuiltin( Type);34 static bool isDecoratable( Spec ); 35 static bool isGeneratable( Spec ); 36 static bool isOverloadable( Spec ); 37 static bool isOverridable( Spec ); 38 static bool isBuiltin( Spec ); 39 39 }; 40 40 -
src/Parser/ParseNode.h
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 23:15:59201613 // Update Count : 54 112 // Last Modified On : Thu Aug 18 23:48:37 2016 13 // Update Count : 542 14 14 // 15 15 … … 273 273 bool get_hasEllipsis() const; 274 274 const std::string &get_name() const { return name; } 275 LinkageSpec:: Typeget_linkage() const { return linkage; }275 LinkageSpec::Spec get_linkage() const { return linkage; } 276 276 DeclarationNode *extractAggregate() const; 277 277 ExpressionNode *get_enumeratorValue() const { return enumeratorValue; } … … 293 293 InitializerNode *initializer; 294 294 bool hasEllipsis; 295 LinkageSpec:: Typelinkage;295 LinkageSpec::Spec linkage; 296 296 bool extension = false; 297 297 std::string error; -
src/Parser/TypeData.cc
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:47:48201613 // Update Count : 6 312 // Last Modified On : Thu Aug 18 23:48:44 2016 13 // Update Count : 64 14 14 // 15 15 … … 478 478 } 479 479 480 Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec:: Typelinkage, Initializer *init ) const {480 Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer *init ) const { 481 481 if ( kind == TypeData::Function ) { 482 482 FunctionDecl *decl; -
src/Parser/TypeData.h
rf487962 r8b7ee09 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 15 14:28:32 201613 // Update Count : 2 112 // Last Modified On : Thu Aug 18 23:48:52 2016 13 // Update Count : 22 14 14 // 15 15 … … 126 126 TypeData * extractAggregate( bool toplevel = true ) const; 127 127 // helper function for DeclNodeImpl::build 128 Declaration * buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec:: Typelinkage, Initializer * init = 0 ) const;128 Declaration * buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init = 0 ) const; 129 129 // helper functions for build() 130 130 Type::Qualifiers buildQualifiers() const; -
src/Parser/parser.cc
rf487962 r8b7ee09 84 84 85 85 extern DeclarationNode * parseTree; 86 extern LinkageSpec:: Typelinkage;86 extern LinkageSpec::Spec linkage; 87 87 extern TypedefTable typedefTable; 88 88 89 std::stack< LinkageSpec:: Type> linkageStack;89 std::stack< LinkageSpec::Spec > linkageStack; 90 90 91 91 void appendStr( std::string &to, std::string *from ) { -
src/Parser/parser.yy
rf487962 r8b7ee09 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 11:18:40 201613 // Update Count : 190 812 // Last Modified On : Thu Aug 18 23:49:10 2016 13 // Update Count : 1909 14 14 // 15 15 … … 56 56 57 57 extern DeclarationNode * parseTree; 58 extern LinkageSpec:: Typelinkage;58 extern LinkageSpec::Spec linkage; 59 59 extern TypedefTable typedefTable; 60 60 61 std::stack< LinkageSpec:: Type> linkageStack;61 std::stack< LinkageSpec::Spec > linkageStack; 62 62 63 63 void appendStr( std::string &to, std::string *from ) { -
src/SynTree/Declaration.cc
rf487962 r8b7ee09 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Dec 09 14:08:29 201513 // Update Count : 1 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:49:57 2016 13 // Update Count : 13 14 14 // 15 15 … … 27 27 static IdMapType idMap; 28 28 29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage )29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage ) 30 30 : name( name ), storageClass( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) { 31 31 } -
src/SynTree/Declaration.h
rf487962 r8b7ee09 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 Jul 12 21:03:17201613 // Update Count : 3912 // Last Modified On : Thu Aug 18 23:50:24 2016 13 // Update Count : 40 14 14 // 15 15 … … 26 26 class Declaration { 27 27 public: 28 Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage );28 Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage ); 29 29 Declaration( const Declaration &other ); 30 30 virtual ~Declaration(); … … 34 34 DeclarationNode::StorageClass get_storageClass() const { return storageClass; } 35 35 void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; } 36 LinkageSpec:: Typeget_linkage() const { return linkage; }37 void set_linkage( LinkageSpec:: TypenewValue ) { linkage = newValue; }36 LinkageSpec::Spec get_linkage() const { return linkage; } 37 void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; } 38 38 bool get_isInline() const { return isInline; } 39 39 void set_isInline( bool newValue ) { isInline = newValue; } … … 56 56 std::string name; 57 57 DeclarationNode::StorageClass storageClass; 58 LinkageSpec:: Typelinkage;58 LinkageSpec::Spec linkage; 59 59 bool isInline, isNoreturn; 60 60 UniqueId uniqueId; … … 64 64 class DeclarationWithType : public Declaration { 65 65 public: 66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, const std::list< Attribute * > & attributes );66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes ); 67 67 DeclarationWithType( const DeclarationWithType &other ); 68 68 virtual ~DeclarationWithType(); … … 97 97 typedef DeclarationWithType Parent; 98 98 public: 99 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false );99 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false ); 100 100 ObjectDecl( const ObjectDecl &other ); 101 101 virtual ~ObjectDecl(); … … 123 123 typedef DeclarationWithType Parent; 124 124 public: 125 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, const std::list< Attribute * > attributes = std::list< Attribute * >() );125 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, const std::list< Attribute * > attributes = std::list< Attribute * >() ); 126 126 FunctionDecl( const FunctionDecl &other ); 127 127 virtual ~FunctionDecl(); -
src/SynTree/DeclarationWithType.cc
rf487962 r8b7ee09 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Mon Apr 11 15:35:27201613 // Update Count : 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:50:41 2016 13 // Update Count : 4 14 14 // 15 15 … … 19 19 #include "Common/utility.h" 20 20 21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, const std::list< Attribute * > & attributes )21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes ) 22 22 : Declaration( name, sc, linkage ), attributes( attributes ) { 23 23 } -
src/SynTree/FunctionDecl.cc
rf487962 r8b7ee09 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 06 15:59:48201613 // Update Count : 1911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:50:14 2016 13 // Update Count : 20 14 14 // 15 15 … … 22 22 #include "Common/utility.h" 23 23 24 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )24 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes ) 25 25 : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) { 26 26 set_isInline( isInline ); -
src/SynTree/ObjectDecl.cc
rf487962 r8b7ee09 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 13:23:32201613 // Update Count : 3 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:50:33 2016 13 // Update Count : 31 14 14 // 15 15 … … 22 22 #include "Statement.h" 23 23 24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec:: Typelinkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn )24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn ) 25 25 : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 26 26 set_isInline( isInline ); -
src/main.cc
rf487962 r8b7ee09 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 16:33:49201613 // Update Count : 3 4712 // Last Modified On : Fri Aug 19 08:31:22 2016 13 // Update Count : 350 14 14 // 15 15 … … 43 43 44 44 45 LinkageSpec:: Typelinkage = LinkageSpec::Cforall;45 LinkageSpec::Spec linkage = LinkageSpec::Cforall; 46 46 TypedefTable typedefTable; 47 47 DeclarationNode * parseTree = nullptr; // program parse tree … … 67 67 68 68 static void parse_cmdline( int argc, char *argv[], const char *& filename ); 69 static void parse( FILE * input, LinkageSpec:: Type t, bool shouldExit = false );69 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 70 70 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout ); 71 71 … … 348 348 } // parse_cmdline 349 349 350 static void parse( FILE * input, LinkageSpec:: Type link, bool shouldExit ) {350 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit ) { 351 351 extern int yyparse( void ); 352 352 extern FILE * yyin; 353 353 extern int yylineno; 354 354 355 linkage = link;// set globals355 ::linkage = linkage; // set globals 356 356 yyin = input; 357 357 yylineno = 1;
Note: See TracChangeset
for help on using the changeset viewer.