Changeset 9a1e509 for src/Common


Ignore:
Timestamp:
Jul 13, 2017, 3:57:23 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
bf30ab3
Parents:
1d776fd (diff), 3d4b23fa (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.
Message:

Merge branch 'master' into references

Location:
src/Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Assert.cc

    r1d776fd r9a1e509  
    1414//
    1515
    16 #include <assert.h>
    17 #include <cstdarg>                                                                              // varargs
    18 #include <cstdio>                                                                               // fprintf
    19 #include <cstdlib>                                                                              // abort
     16#include <cstdarg>  // for va_end, va_list, va_start
     17#include <cstdio>   // for fprintf, stderr, vfprintf
     18#include <cstdlib>  // for abort
    2019
    2120extern const char * __progname;                                                 // global name of running executable (argv[0])
  • src/Common/SemanticError.cc

    r1d776fd r9a1e509  
    1414//
    1515
    16 #include <iostream>
    17 #include <list>
    18 #include <string>
    19 #include <algorithm>
    20 #include <iterator>
     16#include <cstdio>            // for fileno, stderr
     17#include <unistd.h>          // for isatty
     18#include <iostream>          // for basic_ostream, operator<<, ostream
     19#include <list>              // for list, _List_iterator
     20#include <string>            // for string, operator<<, operator+, to_string
    2121
     22#include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
    2223#include "SemanticError.h"
    23 
    24 #include <unistd.h>
    2524
    2625inline const std::string& error_str() {
  • src/Common/SemanticError.h

    r1d776fd r9a1e509  
    1717#define SEMANTICERROR_H
    1818
    19 #include <exception>
    20 #include <string>
    21 #include <sstream>
    22 #include <list>
    23 #include <iostream>
     19#include <exception>  // for exception
     20#include <iostream>   // for ostream
     21#include <list>       // for list
     22#include <string>     // for string
    2423
    25 #include "utility.h"
     24#include "utility.h"  // for CodeLocation, toString
    2625
    2726struct error {
  • src/Common/utility.h

    r1d776fd r9a1e509  
    2525#include <sstream>
    2626#include <string>
     27#include <type_traits>
    2728
    2829#include <cassert>
     
    305306// for ( val : group_iterate( container1, container2, ... ) ) {}
    306307// syntax to have a for each that iterates multiple containers of the same length
    307 // TODO: update to use variadic arguments, perfect forwarding
     308// TODO: update to use variadic arguments
    308309
    309310template< typename T1, typename T2 >
     
    314315
    315316        struct iterator {
    316                 typedef std::tuple<typename T1::value_type, typename T2::value_type> value_type;
    317                 typedef typename T1::iterator T1Iter;
    318                 typedef typename T2::iterator T2Iter;
     317                typedef typename std::remove_reference<T1>::type T1val;
     318                typedef typename std::remove_reference<T2>::type T2val;
     319                typedef std::tuple<typename T1val::value_type &, typename T2val::value_type &> value_type;
     320                typedef typename T1val::iterator T1Iter;
     321                typedef typename T2val::iterator T2Iter;
    319322                typedef std::tuple<T1Iter, T2Iter> IterTuple;
    320323                IterTuple it;
     
    324327                }
    325328                bool operator!=( const iterator &other ) const { return it != other.it; }
    326                 value_type operator*() const { return std::make_tuple( *std::get<0>(it), *std::get<1>(it) ); }
     329                value_type operator*() const { return std::tie( *std::get<0>(it), *std::get<1>(it) ); }
    327330        };
    328331        iterator begin() { return iterator( std::get<0>(args).begin(), std::get<1>(args).begin() ); }
     
    334337
    335338template< typename... Args >
    336 group_iterate_t<Args...> group_iterate( const Args &... args ) {
    337         return group_iterate_t<Args...>(args...);
     339group_iterate_t<Args...> group_iterate( Args &&... args ) {
     340        return group_iterate_t<Args...>(std::forward<Args>( args )...);
    338341}
    339342
Note: See TracChangeset for help on using the changeset viewer.