Ignore:
Timestamp:
Aug 22, 2017, 7:31:52 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:
9aaac6e9
Parents:
fc56cdbf (diff), b3d413b (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rfc56cdbf r8135d4c  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:19:13 2017
    13 // Update Count     : 33
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 11:38:00 2017
     13// Update Count     : 34
    1414//
    1515
     
    2727
    2828#include <cassert>
     29
    2930template< typename T >
    3031static inline T * maybeClone( const T *orig ) {
     
    347348}
    348349
    349 struct CodeLocation {
    350         int linenumber;
    351         std::string filename;
    352 
    353         /// Create a new unset CodeLocation.
    354         CodeLocation()
    355                 : linenumber( -1 )
    356                 , filename("")
    357         {}
    358 
    359         /// Create a new CodeLocation with the given values.
    360         CodeLocation( const char* filename, int lineno )
    361                 : linenumber( lineno )
    362                 , filename(filename ? filename : "")
    363         {}
    364 
    365         CodeLocation( const CodeLocation& rhs ) = default;
    366 
    367         bool isSet () const {
    368                 return -1 != linenumber;
    369         }
    370 
    371         bool isUnset () const {
    372                 return !isSet();
    373         }
    374 
    375         void unset () {
    376                 linenumber = -1;
    377                 filename = "";
    378         }
    379 
    380         // Use field access for set.
    381 };
    382 
    383 inline std::string to_string( const CodeLocation& location ) {
    384         return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
    385 }
    386 
    387350// Local Variables: //
    388351// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.