Index: src/SymTab/Mangler.cc
===================================================================
--- src/SymTab/Mangler.cc	(revision 954c954fd6522dace325fb95ef0cfd3247c319c3)
+++ src/SymTab/Mangler.cc	(revision cde1bf91c0bfca05aacca4df9ecd39e5629690a5)
@@ -10,6 +10,6 @@
 // Created On       : Sun May 17 21:40:29 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Feb 15 13:55:12 2020
-// Update Count     : 33
+// Last Modified On : Wed Nov 18 12:01:38 2020
+// Update Count     : 64
 //
 #include "Mangler.h"
@@ -65,7 +65,7 @@
 				void postvisit( const QualifiedType * qualType );
 
-				std::string get_mangleName() { return mangleName.str(); }
+				std::string get_mangleName() { return mangleName; }
 			  private:
-				std::ostringstream mangleName;  ///< Mangled name being constructed
+				std::string mangleName;         ///< Mangled name being constructed
 				typedef std::map< std::string, std::pair< int, int > > VarMapType;
 				VarMapType varNums;             ///< Map of type variables to indices
@@ -127,10 +127,10 @@
 					isTopLevel = false;
 				} // if
-				mangleName << Encoding::manglePrefix;
+				mangleName += Encoding::manglePrefix;
 				const CodeGen::OperatorInfo * opInfo = CodeGen::operatorLookup( declaration->get_name() );
 				if ( opInfo ) {
-					mangleName << opInfo->outputName.size() << opInfo->outputName;
+					mangleName += std::to_string( opInfo->outputName.size() ) + opInfo->outputName;
 				} else {
-					mangleName << declaration->name.size() << declaration->name;
+					mangleName += std::to_string( declaration->name.size() ) + declaration->name;
 				} // if
 				maybeAccept( declaration->get_type(), *visitor );
@@ -139,7 +139,7 @@
 					// so they need a different name mangling
 					if ( declaration->get_linkage() == LinkageSpec::AutoGen ) {
-						mangleName << Encoding::autogen;
+						mangleName += Encoding::autogen;
 					} else if ( declaration->get_linkage() == LinkageSpec::Intrinsic ) {
-						mangleName << Encoding::intrinsic;
+						mangleName += Encoding::intrinsic;
 					} else {
 						// if we add another kind of overridable function, this has to change
@@ -160,5 +160,5 @@
 			void Mangler_old::postvisit( const VoidType * voidType ) {
 				printQualifiers( voidType );
-				mangleName << Encoding::void_t;
+				mangleName += Encoding::void_t;
 			}
 
@@ -166,5 +166,5 @@
 				printQualifiers( basicType );
 				assertf( basicType->kind < BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->kind );
-				mangleName << Encoding::basicTypes[ basicType->kind ];
+				mangleName += Encoding::basicTypes[ basicType->kind ];
 			}
 
@@ -172,5 +172,5 @@
 				printQualifiers( pointerType );
 				// mangle void (*f)() and void f() to the same name to prevent overloading on functions and function pointers
-				if ( ! dynamic_cast<FunctionType *>( pointerType->base ) ) mangleName << Encoding::pointer;
+				if ( ! dynamic_cast<FunctionType *>( pointerType->base ) ) mangleName += Encoding::pointer;
 				maybeAccept( pointerType->base, *visitor );
 			}
@@ -179,5 +179,5 @@
 				// TODO: encode dimension
 				printQualifiers( arrayType );
-				mangleName << Encoding::array << "0";
+				mangleName += Encoding::array + "0";
 				maybeAccept( arrayType->base, *visitor );
 			}
@@ -204,5 +204,5 @@
 			void Mangler_old::postvisit( const FunctionType * functionType ) {
 				printQualifiers( functionType );
-				mangleName << Encoding::function;
+				mangleName += Encoding::function;
 				// turn on inFunctionType so that printQualifiers does not print most qualifiers for function parameters,
 				// since qualifiers on outermost parameter type do not differentiate function types, e.g.,
@@ -211,10 +211,10 @@
 				inFunctionType = true;
 				std::list< Type* > returnTypes = getTypes( functionType->returnVals );
-				if (returnTypes.empty()) mangleName << Encoding::void_t;
+				if (returnTypes.empty()) mangleName += Encoding::void_t;
 				else acceptAll( returnTypes, *visitor );
-				mangleName << "_";
+				mangleName += "_";
 				std::list< Type* > paramTypes = getTypes( functionType->parameters );
 				acceptAll( paramTypes, *visitor );
-				mangleName << "_";
+				mangleName += "_";
 			}
 
@@ -222,10 +222,10 @@
 				printQualifiers( refType );
 
-				mangleName << prefix << refType->name.length() << refType->name;
+				mangleName += prefix + std::to_string( refType->name.length() ) + refType->name;
 
 				if ( mangleGenericParams ) {
 					const std::list< Expression* > & params = refType->parameters;
 					if ( ! params.empty() ) {
-						mangleName << "_";
+						mangleName += "_";
 						for ( const Expression * param : params ) {
 							const TypeExpr * paramType = dynamic_cast< const TypeExpr * >( param );
@@ -233,5 +233,5 @@
 							maybeAccept( paramType->type, *visitor );
 						}
-						mangleName << "_";
+						mangleName += "_";
 					}
 				}
@@ -262,5 +262,5 @@
 					// are first found and prefixing with the appropriate encoding for the type class.
 					assertf( varNum->second.second < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", varNum->second.second );
-					mangleName << Encoding::typeVariables[varNum->second.second] << varNum->second.first;
+					mangleName += Encoding::typeVariables[varNum->second.second] + std::to_string( varNum->second.first );
 				} // if
 			}
@@ -268,10 +268,10 @@
 			void Mangler_old::postvisit( const TraitInstType * inst ) {
 				printQualifiers( inst );
-				mangleName << inst->name.size() << inst->name;
+				mangleName += std::to_string( inst->name.size() ) + inst->name;
 			}
 
 			void Mangler_old::postvisit( const TupleType * tupleType ) {
 				printQualifiers( tupleType );
-				mangleName << Encoding::tuple << tupleType->types.size();
+				mangleName += Encoding::tuple + std::to_string( tupleType->types.size() );
 				acceptAll( tupleType->types, *visitor );
 			}
@@ -280,13 +280,13 @@
 				printQualifiers( varArgsType );
 				static const std::string vargs = "__builtin_va_list";
-				mangleName << Encoding::type << vargs.size() << vargs;
+				mangleName += Encoding::type + std::to_string( vargs.size() ) + vargs;
 			}
 
 			void Mangler_old::postvisit( const ZeroType * ) {
-				mangleName << Encoding::zero;
+				mangleName += Encoding::zero;
 			}
 
 			void Mangler_old::postvisit( const OneType * ) {
-				mangleName << Encoding::one;
+				mangleName += Encoding::one;
 			}
 
@@ -296,5 +296,5 @@
 					// N marks the start of a qualified type
 					inQualifiedType = true;
-					mangleName << Encoding::qualifiedTypeStart;
+					mangleName += Encoding::qualifiedTypeStart;
 				}
 				maybeAccept( qualType->parent, *visitor );
@@ -303,5 +303,5 @@
 					// E marks the end of a qualified type
 					inQualifiedType = false;
-					mangleName << Encoding::qualifiedTypeEnd;
+					mangleName += Encoding::qualifiedTypeEnd;
 				}
 			}
@@ -315,5 +315,5 @@
 				assertf(false, "Mangler_old should not visit typedecl: %s", toCString(decl));
 				assertf( decl->kind < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind );
-				mangleName << Encoding::typeVariables[ decl->kind ] << ( decl->name.length() ) << decl->name;
+				mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name;
 			}
 
@@ -330,5 +330,5 @@
 					std::list< std::string > assertionNames;
 					int dcount = 0, fcount = 0, vcount = 0, acount = 0;
-					mangleName << Encoding::forall;
+					mangleName += Encoding::forall;
 					for ( const TypeDecl * i : type->forall ) {
 						switch ( i->kind ) {
@@ -354,26 +354,27 @@
 						} // for
 					} // for
-					mangleName << dcount << "_" << fcount << "_" << vcount << "_" << acount << "_";
-					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
-					mangleName << "_";
+					mangleName += std::to_string( dcount ) + "_" + std::to_string( fcount ) + "_" + std::to_string( vcount ) + "_" + std::to_string( acount ) + "_";
+					for(const auto & a : assertionNames) mangleName += a;
+//					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
+					mangleName += "_";
 				} // if
 				if ( ! inFunctionType ) {
 					// these qualifiers do not distinguish the outermost type of a function parameter
 					if ( type->get_const() ) {
-						mangleName << Encoding::qualifiers.at(Type::Const);
+						mangleName += Encoding::qualifiers.at(Type::Const);
 					} // if
 					if ( type->get_volatile() ) {
-						mangleName << Encoding::qualifiers.at(Type::Volatile);
+						mangleName += Encoding::qualifiers.at(Type::Volatile);
 					} // if
 					// Removed due to restrict not affecting function compatibility in GCC
 					// if ( type->get_isRestrict() ) {
-					// 	mangleName << "E";
+					// 	mangleName += "E";
 					// } // if
 					if ( type->get_atomic() ) {
-						mangleName << Encoding::qualifiers.at(Type::Atomic);
+						mangleName += Encoding::qualifiers.at(Type::Atomic);
 					} // if
 				}
 				if ( type->get_mutex() ) {
-					mangleName << Encoding::qualifiers.at(Type::Mutex);
+					mangleName += Encoding::qualifiers.at(Type::Mutex);
 				} // if
 				if ( inFunctionType ) {
@@ -383,5 +384,5 @@
 				}
 			}
-		}	// namespace
+		} // namespace
 	} // namespace Mangler
 } // namespace SymTab
@@ -417,7 +418,7 @@
 			void postvisit( const ast::QualifiedType * qualType );
 
-			std::string get_mangleName() { return mangleName.str(); }
+			std::string get_mangleName() { return mangleName; }
 		  private:
-			std::ostringstream mangleName;  ///< Mangled name being constructed
+			std::string mangleName;         ///< Mangled name being constructed
 			typedef std::map< std::string, std::pair< int, int > > VarMapType;
 			VarMapType varNums;             ///< Map of type variables to indices
@@ -470,10 +471,10 @@
 				isTopLevel = false;
 			} // if
-			mangleName << Encoding::manglePrefix;
+			mangleName += Encoding::manglePrefix;
 			const CodeGen::OperatorInfo * opInfo = CodeGen::operatorLookup( decl->name );
 			if ( opInfo ) {
-				mangleName << opInfo->outputName.size() << opInfo->outputName;
+				mangleName += std::to_string( opInfo->outputName.size() ) + opInfo->outputName;
 			} else {
-				mangleName << decl->name.size() << decl->name;
+				mangleName += std::to_string( decl->name.size() ) + decl->name;
 			} // if
 			maybeAccept( decl->get_type(), *visitor );
@@ -482,7 +483,7 @@
 				// so they need a different name mangling
 				if ( decl->linkage == ast::Linkage::AutoGen ) {
-					mangleName << Encoding::autogen;
+					mangleName += Encoding::autogen;
 				} else if ( decl->linkage == ast::Linkage::Intrinsic ) {
-					mangleName << Encoding::intrinsic;
+					mangleName += Encoding::intrinsic;
 				} else {
 					// if we add another kind of overridable function, this has to change
@@ -503,5 +504,5 @@
 		void Mangler_new::postvisit( const ast::VoidType * voidType ) {
 			printQualifiers( voidType );
-			mangleName << Encoding::void_t;
+			mangleName += Encoding::void_t;
 		}
 
@@ -509,5 +510,5 @@
 			printQualifiers( basicType );
 			assertf( basicType->kind < ast::BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->kind );
-			mangleName << Encoding::basicTypes[ basicType->kind ];
+			mangleName += Encoding::basicTypes[ basicType->kind ];
 		}
 
@@ -515,5 +516,5 @@
 			printQualifiers( pointerType );
 			// mangle void (*f)() and void f() to the same name to prevent overloading on functions and function pointers
-			if ( ! pointerType->base.as<ast::FunctionType>() ) mangleName << Encoding::pointer;
+			if ( ! pointerType->base.as<ast::FunctionType>() ) mangleName += Encoding::pointer;
 			maybe_accept( pointerType->base.get(), *visitor );
 		}
@@ -522,5 +523,5 @@
 			// TODO: encode dimension
 			printQualifiers( arrayType );
-			mangleName << Encoding::array << "0";
+			mangleName += Encoding::array + "0";
 			maybeAccept( arrayType->base.get(), *visitor );
 		}
@@ -545,5 +546,5 @@
 		void Mangler_new::postvisit( const ast::FunctionType * functionType ) {
 			printQualifiers( functionType );
-			mangleName << Encoding::function;
+			mangleName += Encoding::function;
 			// turn on inFunctionType so that printQualifiers does not print most qualifiers for function parameters,
 			// since qualifiers on outermost parameter type do not differentiate function types, e.g.,
@@ -551,9 +552,9 @@
 			GuardValue( inFunctionType );
 			inFunctionType = true;
-			if (functionType->returns.empty()) mangleName << Encoding::void_t;
+			if (functionType->returns.empty()) mangleName += Encoding::void_t;
 			else accept_each( functionType->returns, *visitor );
-			mangleName << "_";
+			mangleName += "_";
 			accept_each( functionType->params, *visitor );
-			mangleName << "_";
+			mangleName += "_";
 		}
 
@@ -561,9 +562,9 @@
 			printQualifiers( refType );
 
-			mangleName << prefix << refType->name.length() << refType->name;
+			mangleName += prefix + std::to_string( refType->name.length() ) + refType->name;
 
 			if ( mangleGenericParams ) {
 				if ( ! refType->params.empty() ) {
-					mangleName << "_";
+					mangleName += "_";
 					for ( const ast::Expr * param : refType->params ) {
 						auto paramType = dynamic_cast< const ast::TypeExpr * >( param );
@@ -571,5 +572,5 @@
 						maybeAccept( paramType->type.get(), *visitor );
 					}
-					mangleName << "_";
+					mangleName += "_";
 				}
 			}
@@ -600,5 +601,5 @@
 				// are first found and prefixing with the appropriate encoding for the type class.
 				assertf( varNum->second.second < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", varNum->second.second );
-				mangleName << Encoding::typeVariables[varNum->second.second] << varNum->second.first;
+				mangleName += Encoding::typeVariables[varNum->second.second] + std::to_string( varNum->second.first );
 			} // if
 		}
@@ -606,10 +607,10 @@
 		void Mangler_new::postvisit( const ast::TraitInstType * inst ) {
 			printQualifiers( inst );
-			mangleName << inst->name.size() << inst->name;
+			mangleName += std::to_string( inst->name.size() ) + inst->name;
 		}
 
 		void Mangler_new::postvisit( const ast::TupleType * tupleType ) {
 			printQualifiers( tupleType );
-			mangleName << Encoding::tuple << tupleType->types.size();
+			mangleName += Encoding::tuple + std::to_string( tupleType->types.size() );
 			accept_each( tupleType->types, *visitor );
 		}
@@ -618,13 +619,13 @@
 			printQualifiers( varArgsType );
 			static const std::string vargs = "__builtin_va_list";
-			mangleName << Encoding::type << vargs.size() << vargs;
+			mangleName += Encoding::type + std::to_string( vargs.size() ) + vargs;
 		}
 
 		void Mangler_new::postvisit( const ast::ZeroType * ) {
-			mangleName << Encoding::zero;
+			mangleName += Encoding::zero;
 		}
 
 		void Mangler_new::postvisit( const ast::OneType * ) {
-			mangleName << Encoding::one;
+			mangleName += Encoding::one;
 		}
 
@@ -634,5 +635,5 @@
 				// N marks the start of a qualified type
 				inQualifiedType = true;
-				mangleName << Encoding::qualifiedTypeStart;
+				mangleName += Encoding::qualifiedTypeStart;
 			}
 			maybeAccept( qualType->parent.get(), *visitor );
@@ -641,5 +642,5 @@
 				// E marks the end of a qualified type
 				inQualifiedType = false;
-				mangleName << Encoding::qualifiedTypeEnd;
+				mangleName += Encoding::qualifiedTypeEnd;
 			}
 		}
@@ -653,5 +654,5 @@
 			assertf(false, "Mangler_new should not visit typedecl: %s", toCString(decl));
 			assertf( decl->kind < ast::TypeDecl::Kind::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind );
-			mangleName << Encoding::typeVariables[ decl->kind ] << ( decl->name.length() ) << decl->name;
+			mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name;
 		}
 
@@ -669,5 +670,5 @@
 					std::list< std::string > assertionNames;
 					int dcount = 0, fcount = 0, vcount = 0, acount = 0;
-					mangleName << Encoding::forall;
+					mangleName += Encoding::forall;
 					for ( const ast::TypeDecl * decl : ptype->forall ) {
 						switch ( decl->kind ) {
@@ -693,7 +694,8 @@
 						} // for
 					} // for
-					mangleName << dcount << "_" << fcount << "_" << vcount << "_" << acount << "_";
-					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
-					mangleName << "_";
+					mangleName += std::to_string( dcount ) + "_" + std::to_string( fcount ) + "_" + std::to_string( vcount ) + "_" + std::to_string( acount ) + "_";
+					for(const auto & a : assertionNames) mangleName += a;
+//					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
+					mangleName += "_";
 				} // if
 			} // if
@@ -701,19 +703,19 @@
 				// these qualifiers do not distinguish the outermost type of a function parameter
 				if ( type->is_const() ) {
-					mangleName << Encoding::qualifiers.at(Type::Const);
+					mangleName += Encoding::qualifiers.at(Type::Const);
 				} // if
 				if ( type->is_volatile() ) {
-					mangleName << Encoding::qualifiers.at(Type::Volatile);
+					mangleName += Encoding::qualifiers.at(Type::Volatile);
 				} // if
 				// Removed due to restrict not affecting function compatibility in GCC
 				// if ( type->get_isRestrict() ) {
-				// 	mangleName << "E";
+				// 	mangleName += "E";
 				// } // if
 				if ( type->is_atomic() ) {
-					mangleName << Encoding::qualifiers.at(Type::Atomic);
+					mangleName += Encoding::qualifiers.at(Type::Atomic);
 				} // if
 			}
 			if ( type->is_mutex() ) {
-				mangleName << Encoding::qualifiers.at(Type::Mutex);
+				mangleName += Encoding::qualifiers.at(Type::Mutex);
 			} // if
 			if ( inFunctionType ) {
