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) {
51
51
// - The initializers for each of the variables are pure
52
52
exists ( DeclStmt ds |
53
53
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 ( ) |
55
57
exists ( LocalScopeVariable v |
56
58
d = v and
57
59
v .getInitializer ( ) .getExpr ( ) .isPure ( ) and
@@ -123,5 +125,7 @@ where
123
125
// output". We therefore exclude unreachable statements as they are, by definition, not executed.
124
126
not s .getBasicBlock ( ) = any ( UnreachableBasicBlock ubb ) .getABasicBlock ( ) and
125
127
// 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 ( )
127
131
select s , "This statement is dead code."
You can’t perform that action at this time.
0 commit comments