Skip to content

Commit 6214cd1

Browse files
committed
C++: Cleanup.
1 parent 59170ee commit 6214cd1

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

cpp/ql/lib/semmle/code/cpp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,26 @@ private module Input2 implements Impl::Private::InputSig2 {
171171
result = e.(ConversionCall).getQualifier().(LambdaExpression).getLambdaFunction()
172172
}
173173

174+
private predicate isRelevantUltimateDefinition(Ssa::DirectExplicitDefinition def, Function f) {
175+
f =
176+
getFunctionFromExpr(def.getAssignedInstruction()
177+
.(StoreInstruction)
178+
.getSourceValue()
179+
.getUnconvertedResultExpression())
180+
}
181+
174182
private module GetAnUltimateDefinitionInput implements Ssa::GetAnUltimateDefinitionSig {
175183
predicate isRelevantUltimateDefinition(Ssa::Definition def) {
176-
exists(
177-
getFunctionFromExpr(def.(Ssa::DirectExplicitDefinition)
178-
.getAssignedInstruction()
179-
.(StoreInstruction)
180-
.getSourceValue()
181-
.getUnconvertedResultExpression())
182-
)
184+
isRelevantUltimateDefinition(def, _)
183185
}
184186
}
185187

186-
private Ssa::Definition getAnUltimateDefinition(Ssa::Definition def) {
187-
result =
188-
Ssa::GetAnUltimateDefinition<GetAnUltimateDefinitionInput>::getAnUltimateDefinition(def)
188+
private predicate hasAnUltimateFunctionAccessDefinition(Ssa::Definition def, Function f) {
189+
exists(Ssa::Definition ultimate |
190+
ultimate =
191+
Ssa::GetAnUltimateDefinition<GetAnUltimateDefinitionInput>::getAnUltimateDefinition(def) and
192+
isRelevantUltimateDefinition(ultimate, f)
193+
)
189194
}
190195

191196
class SourceSinkReportingElement extends Element {
@@ -207,13 +212,7 @@ private module Input2 implements Impl::Private::InputSig2 {
207212
// The expression is an SSA read of an assignment of a callable
208213
exists(Ssa::Definition def |
209214
def.getAUse().getDef().getUnconvertedResultExpression() = this and
210-
result =
211-
getFunctionFromExpr(getAnUltimateDefinition(def)
212-
.(Ssa::DirectExplicitDefinition)
213-
.getAssignedInstruction()
214-
.(StoreInstruction)
215-
.getSourceValue()
216-
.getUnconvertedResultExpression())
215+
hasAnUltimateFunctionAccessDefinition(def, result)
217216
)
218217
}
219218

0 commit comments

Comments
 (0)