File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
cpp/ql/src/semmle/code/cpp/dataflow/internal Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -221,9 +221,7 @@ module FlowVar_internal {
221221 BlockVar ( ) { this = TBlockVar ( sbb , v ) }
222222
223223 override VariableAccess getAnAccess ( ) {
224- result .getTarget ( ) = v and
225- result = getAReachedBlockVarSBB ( this ) .getANode ( ) and
226- not overwrite ( result , _)
224+ variableAccessInSBB ( v , getAReachedBlockVarSBB ( this ) , result )
227225 }
228226
229227 override predicate definedByInitialValue ( LocalScopeVariable lsv ) {
@@ -373,6 +371,15 @@ module FlowVar_internal {
373371 )
374372 }
375373
374+ /** Holds if `va` is a read access to `v` in `sbb`, where `v` is modeled by `BlockVar`. */
375+ pragma [ noinline]
376+ private predicate variableAccessInSBB ( Variable v , SubBasicBlock sbb , VariableAccess va ) {
377+ exists ( TBlockVar ( _, v ) ) and
378+ va .getTarget ( ) = v and
379+ va = sbb .getANode ( ) and
380+ not overwrite ( va , _)
381+ }
382+
376383 /**
377384 * A local variable that is uninitialized immediately after its declaration.
378385 */
You can’t perform that action at this time.
0 commit comments