Ignore:
Timestamp:
Aug 17, 2017, 3:42:21 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
e50e9ff
Parents:
97e3296 (diff), 21f0aa8 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    r97e3296 r6ac5223  
    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 ) {
     
    340341}
    341342
    342 struct CodeLocation {
    343         int linenumber;
    344         std::string filename;
    345 
    346         /// Create a new unset CodeLocation.
    347         CodeLocation()
    348                 : linenumber( -1 )
    349                 , filename("")
    350         {}
    351 
    352         /// Create a new CodeLocation with the given values.
    353         CodeLocation( const char* filename, int lineno )
    354                 : linenumber( lineno )
    355                 , filename(filename ? filename : "")
    356         {}
    357 
    358         CodeLocation( const CodeLocation& rhs ) = default;
    359 
    360         bool isSet () const {
    361                 return -1 != linenumber;
    362         }
    363 
    364         bool isUnset () const {
    365                 return !isSet();
    366         }
    367 
    368         void unset () {
    369                 linenumber = -1;
    370                 filename = "";
    371         }
    372 
    373         // Use field access for set.
    374 };
    375 
    376 inline std::string to_string( const CodeLocation& location ) {
    377         return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
    378 }
    379 
    380343// Local Variables: //
    381344// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.