Changeset 4a8f150 for src/InitTweak/FixInitNew.cpp
- Timestamp:
- Dec 1, 2020, 3:39:24 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a25f64b
- Parents:
- 41c19b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInitNew.cpp
r41c19b4 r4a8f150 413 413 void SelfAssignChecker::previsit( const ast::ApplicationExpr * appExpr ) { 414 414 auto function = getFunction( appExpr ); 415 if ( function->name == "?=?" ) { // doesn't use isAssignment, because ?+=?, etc. should not count as self-assignment 416 if ( appExpr->args.size() == 2 ) { 417 // check for structural similarity (same variable use, ignore casts, etc. - but does not look too deeply, anything looking like a function is off limits) 418 if ( structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) { 419 SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) ); 420 } 421 } 415 // Doesn't use isAssignment, because ?+=?, etc. should not count as self-assignment. 416 if ( function->name == "?=?" && appExpr->args.size() == 2 417 // Check for structural similarity (same variable use, ignore casts, etc. 418 // (but does not look too deeply, anything looking like a function is off limits). 419 && structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) { 420 SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) ); 422 421 } 423 422 }
Note: See TracChangeset
for help on using the changeset viewer.