File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
cpp/autosar/src/rules/M0-1-9 Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ predicate isDeadStmt(Stmt s) {
5151 // - The initializers for each of the variables are pure
5252 exists ( DeclStmt ds |
5353 ds = s and
54- forall ( Declaration d | d = ds .getADeclaration ( ) |
54+ // Use forex so that we don't flag "fake" generated `DeclStmt`s (e.g. those generated by the
55+ // extractor for static_asserts) with no actual declarations
56+ forex ( Declaration d | d = ds .getADeclaration ( ) |
5557 exists ( LocalScopeVariable v |
5658 d = v and
5759 v .getInitializer ( ) .getExpr ( ) .isPure ( ) and
@@ -123,5 +125,7 @@ where
123125 // output". We therefore exclude unreachable statements as they are, by definition, not executed.
124126 not s .getBasicBlock ( ) = any ( UnreachableBasicBlock ubb ) .getABasicBlock ( ) and
125127 // Exclude code generated by macros, because the code may be "live" in other instantiations
126- not s .isAffectedByMacro ( )
128+ not s .isAffectedByMacro ( ) and
129+ // Exclude compiler generated statements
130+ not s .isCompilerGenerated ( )
127131select s , "This statement is dead code."
You can’t perform that action at this time.
0 commit comments