Changeset 90152a4 for src/SynTree/Type.cc
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Type.cc
rf9feab8 r90152a4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 25 15:16:32 201713 // Update Count : 3 812 // Last Modified On : Fri Jun 22 10:17:19 2018 13 // Update Count : 39 14 14 // 15 15 #include "Type.h" 16 16 17 #include "Attribute.h" // for Attribute 18 #include "Common/utility.h" // for cloneAll, deleteAll, printAll 19 #include "InitTweak/InitTweak.h" // for getPointerBase 20 #include "SynTree/BaseSyntaxNode.h" // for BaseSyntaxNode 21 #include "SynTree/Declaration.h" // for TypeDecl 17 #include "Attribute.h" // for Attribute 18 #include "Common/utility.h" // for cloneAll, deleteAll, printAll 19 #include "InitTweak/InitTweak.h" // for getPointerBase 20 #include "SynTree/BaseSyntaxNode.h" // for BaseSyntaxNode 21 #include "SynTree/Declaration.h" // for TypeDecl 22 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution 22 23 23 24 using namespace std; 24 25 25 const char *BasicType::typeNames[ BasicType::NUMBER_OF_BASIC_TYPES] = {26 const char *BasicType::typeNames[] = { 26 27 "_Bool", 27 28 "char", … … 47 48 "__int128", 48 49 "unsigned __int128", 50 "__float80", 51 "__float128" 49 52 }; 53 static_assert( 54 sizeof(BasicType::typeNames)/sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES, 55 "Each basic type name should have a corresponding kind enum value" 56 ); 50 57 51 58 Type::Type( const Qualifiers &tq, const std::list< Attribute * > & attributes ) : tq( tq ), attributes( attributes ) {} … … 62 69 63 70 // These must remain in the same order as the corresponding bit fields. 64 const char * Type::FuncSpecifiersNames[] = { "inline", " fortran", "_Noreturn" };71 const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" }; 65 72 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" }; 66 73 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" }; … … 81 88 int Type::referenceDepth() const { return 0; } 82 89 90 TypeSubstitution Type::genericSubstitution() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); } 91 83 92 void Type::print( std::ostream &os, Indenter indent ) const { 84 93 if ( ! forall.empty() ) { … … 96 105 } 97 106 107 108 QualifiedType::QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ) : Type( tq, {} ), parent( parent ), child( child ) { 109 } 110 111 QualifiedType::QualifiedType( const QualifiedType & other ) : Type( other ), parent( maybeClone( other.parent ) ), child( maybeClone( other.child ) ) { 112 } 113 114 QualifiedType::~QualifiedType() { 115 delete parent; 116 delete child; 117 } 118 119 void QualifiedType::print( std::ostream & os, Indenter indent ) const { 120 os << "Qualified Type: " << endl; 121 os << indent+1; 122 parent->print( os, indent+1 ); 123 os << endl << indent+1; 124 child->print( os, indent+1 ); 125 os << endl; 126 Type::print( os, indent+1 ); 127 } 128 129 GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {} 130 131 void GlobalScopeType::print( std::ostream & os, Indenter ) const { 132 os << "Global Scope Type" << endl; 133 } 134 135 98 136 // Empty Variable declarations: 99 137 const Type::FuncSpecifiers noFuncSpecifiers;
Note:
See TracChangeset
for help on using the changeset viewer.