@@ -10,6 +10,7 @@ private import TranslatedElement
1010private import TranslatedExpr
1111private import TranslatedFunction
1212private import TranslatedInitialization
13+ private import TranslatedAssertion
1314
1415TranslatedStmt getTranslatedStmt ( Stmt stmt ) { result .getAst ( ) = stmt }
1516
@@ -324,8 +325,16 @@ abstract class TranslatedStmt extends TranslatedElement, TTranslatedStmt {
324325
325326class TranslatedEmptyStmt extends TranslatedStmt {
326327 TranslatedEmptyStmt ( ) {
327- stmt instanceof EmptyStmt or
328- stmt instanceof LabelStmt or
328+ // An assertion macro invocation can expand to
329+ // an empty statement in release builds. In that case
330+ // we synthedsize the check that would have occured.
331+ // This is handled by `TranslatedAssertion.qll` and so
332+ // we exclude these statements here.
333+ not assertion ( _, stmt ) and
334+ stmt instanceof EmptyStmt
335+ or
336+ stmt instanceof LabelStmt
337+ or
329338 stmt instanceof SwitchCase
330339 }
331340
@@ -420,6 +429,15 @@ class TranslatedDeclStmt extends TranslatedStmt {
420429class TranslatedExprStmt extends TranslatedStmt {
421430 override ExprStmt stmt ;
422431
432+ TranslatedExprStmt ( ) {
433+ // An assertion macro invocation typically expand to the
434+ // expression `((void)0)` in release builds. In that case
435+ // we synthedsize the check that would have occured.
436+ // This is handled by `TranslatedAssertion.qll` and so
437+ // we exclude these statements here.
438+ not assertion ( _, stmt )
439+ }
440+
423441 TranslatedExpr getExpr ( ) { result = getTranslatedExpr ( stmt .getExpr ( ) .getFullyConverted ( ) ) }
424442
425443 override TranslatedElement getChildInternal ( int id ) { id = 0 and result = this .getExpr ( ) }
0 commit comments