Changeset 21f0aa8 for src/Common
- Timestamp:
- Aug 17, 2017, 2:45:12 PM (7 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:
- 6ac5223, e9145a3
- Parents:
- 936e9f4
- Location:
- src/Common
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.h
r936e9f4 r21f0aa8 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 : Fri Jul 21 22:18:59201713 // Update Count : 611 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 17 14:01:00 2017 13 // Update Count : 7 14 14 // 15 15 … … 21 21 #include <string> // for string 22 22 23 #include " utility.h" // for CodeLocation, toString23 #include "CodeLocation.h" // for CodeLocation, toString 24 24 25 25 struct error { -
src/Common/utility.h
r936e9f4 r21f0aa8 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 : Fri Jul 21 22:19:13201713 // Update Count : 3 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 17 11:38:00 2017 13 // Update Count : 34 14 14 // 15 15 … … 341 341 } 342 342 343 struct CodeLocation {344 int linenumber;345 std::string filename;346 347 /// Create a new unset CodeLocation.348 CodeLocation()349 : linenumber( -1 )350 , filename("")351 {}352 353 /// Create a new CodeLocation with the given values.354 CodeLocation( const char* filename, int lineno )355 : linenumber( lineno )356 , filename(filename ? filename : "")357 {}358 359 CodeLocation( const CodeLocation& rhs ) = default;360 361 bool isSet () const {362 return -1 != linenumber;363 }364 365 bool isUnset () const {366 return !isSet();367 }368 369 void unset () {370 linenumber = -1;371 filename = "";372 }373 374 // Use field access for set.375 };376 377 inline std::string to_string( const CodeLocation& location ) {378 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";379 }380 381 343 // Local Variables: // 382 344 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.