Changeset f04288f
- Timestamp:
- May 8, 2017, 11:01:20 AM (8 years ago)
- 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:
- 7c0ef42
- Parents:
- 805c167 (diff), c352893 (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. - Location:
- src
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r805c167 rf04288f 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Dec 14 21:25:25 201613 // Update Count : 3 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri May 5 11:03:00 2017 13 // Update Count : 32 14 14 // 15 15 … … 322 322 std::string filename; 323 323 324 CodeLocation() 324 /// Create a new unset CodeLocation. 325 CodeLocation() 325 326 : linenumber( -1 ) 326 327 , filename("") 327 328 {} 328 329 330 /// Create a new CodeLocation with the given values. 329 331 CodeLocation( const char* filename, int lineno ) 330 332 : linenumber( lineno ) 331 333 , filename(filename ? filename : "") 332 334 {} 335 336 bool isSet () const { 337 return -1 != linenumber; 338 } 339 340 bool isUnset () const { 341 return !isSet(); 342 } 343 344 void unset () { 345 linenumber = -1; 346 filename = ""; 347 } 348 349 // Use field access for set. 333 350 }; 334 351 335 352 inline std::string to_string( const CodeLocation& location ) { 336 return location. linenumber >= 0? location.filename + ":" + std::to_string(location.linenumber) + " " : "";353 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : ""; 337 354 } 338 355 #endif // _UTILITY_H
Note: See TracChangeset
for help on using the changeset viewer.