Changeset 4e2b9710 for src/CodeGen/GenType.cc
- Timestamp:
- Aug 25, 2016, 9:14:18 PM (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, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- a839867
- Parents:
- c1c1112 (diff), 486341f (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/CodeGen/GenType.cc
rc1c1112 r4e2b9710 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // GenType.cc -- 7 // GenType.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 28 28 class GenType : public Visitor { 29 29 public: 30 GenType( const std::string &typeString );30 GenType( const std::string &typeString, bool mangle = true ); 31 31 std::string get_typeString() const { return typeString; } 32 32 void set_typeString( const std::string &newValue ) { typeString = newValue; } 33 33 34 34 virtual void visit( FunctionType *funcType ); 35 35 virtual void visit( VoidType *voidType ); … … 42 42 virtual void visit( TypeInstType *typeInst ); 43 43 virtual void visit( VarArgsType *varArgsType ); 44 44 45 45 private: 46 46 void handleQualifiers( Type *type ); 47 47 void genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic ); 48 48 49 49 std::string typeString; 50 bool mangle = true; 50 51 }; 51 52 52 std::string genType( Type *type, const std::string &baseString ) {53 GenType gt( baseString );53 std::string genType( Type *type, const std::string &baseString, bool mangle ) { 54 GenType gt( baseString, mangle ); 54 55 type->accept( gt ); 55 56 return gt.get_typeString(); 56 57 } 57 58 58 GenType::GenType( const std::string &typeString ) : typeString( typeString) {}59 GenType::GenType( const std::string &typeString, bool mangle ) : typeString( typeString ), mangle( mangle ) {} 59 60 60 61 void GenType::visit( VoidType *voidType ) { … … 100 101 } // if 101 102 if ( dimension != 0 ) { 102 CodeGenerator cg( os );103 CodeGenerator cg( os, mangle ); 103 104 dimension->accept( cg ); 104 105 } else if ( isVarLen ) { … … 109 110 110 111 typeString = os.str(); 111 112 112 113 base->accept( *this ); 113 114 } … … 142 143 } // if 143 144 } // if 144 145 145 146 /************* parameters ***************/ 146 147 … … 154 155 } // if 155 156 } else { 156 CodeGenerator cg( os );157 CodeGenerator cg( os, mangle ); 157 158 os << "(" ; 158 159 … … 164 165 os << ")"; 165 166 } // if 166 167 167 168 typeString = os.str(); 168 169
Note: See TracChangeset
for help on using the changeset viewer.