Changeset b1e63ac5 for src/Common
- Timestamp:
- Jul 4, 2017, 9:40:16 AM (9 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, stuck-waitfor-destruct, with_gc
- Children:
- 208e5be
- Parents:
- 9c951e3 (diff), f7cb0bc (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/Common
- Files:
-
- 4 added
- 2 edited
-
Assert.cc (modified) (2 diffs)
-
Indenter.h (added)
-
PassVisitor.h (added)
-
PassVisitor.impl.h (added)
-
PassVisitor.proto.h (added)
-
utility.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Assert.cc
r9c951e3 rb1e63ac5 21 21 extern const char * __progname; // global name of running executable (argv[0]) 22 22 23 #define CFA_ASSERT_FMT "*CFA assertion error* from program \"%s\" in \"%s\" at line %d in file \"%s\""23 #define CFA_ASSERT_FMT "*CFA assertion error* \"%s\" from program \"%s\" in \"%s\" at line %d in file \"%s\"" 24 24 25 25 // called by macro assert in assert.h 26 26 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) { 27 fprintf( stderr, CFA_ASSERT_FMT ".\n", __progname, function, line, file );27 fprintf( stderr, CFA_ASSERT_FMT ".\n", assertion, __progname, function, line, file ); 28 28 abort(); 29 29 } … … 31 31 // called by macro assertf 32 32 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) { 33 fprintf( stderr, CFA_ASSERT_FMT ": ", __progname, function, line, file );33 fprintf( stderr, CFA_ASSERT_FMT ": ", assertion, __progname, function, line, file ); 34 34 va_list args; 35 35 va_start( args, fmt ); -
src/Common/utility.h
r9c951e3 rb1e63ac5 246 246 }; 247 247 248 template< typename T > 249 struct ValueGuardPtr { 250 T old; 251 T* ref; 252 253 ValueGuardPtr(T * inRef) : old( inRef ? *inRef : T() ), ref(inRef) {} 254 ~ValueGuardPtr() { if( ref ) *ref = old; } 255 }; 256 257 template< typename T > 258 struct ValueGuardPtr< std::list< T > > { 259 std::list< T > old; 260 std::list< T >* ref; 261 262 ValueGuardPtr( std::list< T > * inRef) : old(), ref(inRef) { 263 if( ref ) { swap( *ref, old ); } 264 } 265 ~ValueGuardPtr() { if( ref ) { swap( *ref, old ); } } 266 }; 267 248 268 // ----------------------------------------------------------------------------- 249 269 // Helper struct and function to support … … 285 305 // for ( val : group_iterate( container1, container2, ... ) ) {} 286 306 // syntax to have a for each that iterates multiple containers of the same length 287 // TODO: update to use variadic arguments 307 // TODO: update to use variadic arguments, perfect forwarding 288 308 289 309 template< typename T1, typename T2 > … … 334 354 {} 335 355 356 CodeLocation( const CodeLocation& rhs ) = default; 357 336 358 bool isSet () const { 337 359 return -1 != linenumber;
Note:
See TracChangeset
for help on using the changeset viewer.