Changeset 5f2f2d7 for src/Common


Ignore:
Timestamp:
Jun 8, 2015, 8:56:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
81419b5
Parents:
cd623a4
Message:

fix constant types, remove unnecessary string copying, work on regression testing, fix several memory leaks

Location:
src/Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    rcd623a4 r5f2f2d7  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 07:22:23 2015
    13 // Update Count     : 1
     12// Last Modified On : Mon Jun  8 14:38:53 2015
     13// Update Count     : 4
    1414//
    1515
     
    1919#include <exception>
    2020#include <string>
    21 #include <strstream>
     21#include <sstream>
    2222#include <list>
    2323#include <iostream>
     
    4242template< typename T >
    4343SemanticError::SemanticError( const std::string &error, const T *obj ) {
    44         std::ostrstream os;
     44        std::ostringstream os;
    4545        os << "Error: " << error;
    4646        obj->print( os );
    47         errors.push_back( std::string( os.str(), os.pcount() ) );
     47        errors.push_back( os.str() );
    4848}
    4949
  • src/Common/UniqueName.cc

    rcd623a4 r5f2f2d7  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 07:23:41 2015
    13 // Update Count     : 1
     12// Last Modified On : Mon Jun  8 14:47:49 2015
     13// Update Count     : 3
    1414//
    1515
    1616#include <string>
    17 #include <strstream>
     17#include <sstream>
    1818
    1919#include "UniqueName.h"
     
    2323
    2424std::string UniqueName::newName( const std::string &additional ) {
    25         std::ostrstream os;
     25        std::ostringstream os;
    2626        os << base << additional << count++;
    27         return std::string( os.str(), os.pcount() );
     27        return os.str();
    2828}
    2929
  • src/Common/utility.h

    rcd623a4 r5f2f2d7  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  4 21:29:57 2015
    13 // Update Count     : 9
     12// Last Modified On : Mon Jun  8 14:43:54 2015
     13// Update Count     : 13
    1414//
    1515
     
    1818
    1919#include <iostream>
    20 #include <strstream>
     20#include <sstream>
    2121#include <iterator>
    2222#include <string>
     
    130130template < typename T >
    131131std::string toString ( T value ) {
    132         std::ostrstream os;
    133  
     132        std::ostringstream os;
    134133        os << value; // << std::ends;
    135         os.freeze( false );
    136 
    137         return std::string(os.str(), os.pcount());
     134        return os.str();
    138135}
    139136
Note: See TracChangeset for help on using the changeset viewer.