@@ -48,7 +48,11 @@ class PotentiallyUnusedLocalVariable extends LocalVariable {
4848 not exists ( AsmStmt s | f = s .getEnclosingFunction ( ) ) and
4949 // Ignore functions with error expressions as they indicate expressions that the extractor couldn't process
5050 not any ( ErrorExpr e ) .getEnclosingFunction ( ) = f
51- )
51+ ) and
52+ // exclude uninstantiated template members
53+ not this .isFromUninstantiatedTemplate ( _) and
54+ // Do not report compiler generated variables
55+ not this .isCompilerGenerated ( )
5256 }
5357}
5458
@@ -95,7 +99,9 @@ class PotentiallyUnusedMemberVariable extends MemberVariable {
9599 // Lambda captures are not "real" member variables - it's an implementation detail that they are represented that way
96100 not this = any ( LambdaCapture lc ) .getField ( ) and
97101 // exclude uninstantiated template members
98- not this .isFromUninstantiatedTemplate ( _)
102+ not this .isFromUninstantiatedTemplate ( _) and
103+ // Do not report compiler generated variables
104+ not this .isCompilerGenerated ( )
99105 }
100106}
101107
@@ -107,7 +113,11 @@ class PotentiallyUnusedGlobalOrNamespaceVariable extends GlobalOrNamespaceVariab
107113 // Not declared in a macro expansion
108114 not isInMacroExpansion ( ) and
109115 // No side-effects from declaration
110- not declarationHasSideEffects ( this )
116+ not declarationHasSideEffects ( this ) and
117+ // exclude uninstantiated template members
118+ not this .isFromUninstantiatedTemplate ( _) and
119+ // Do not report compiler generated variables
120+ not this .isCompilerGenerated ( )
111121 }
112122}
113123
0 commit comments