in source/Highlights.cpp [287:336]
void get_frames_files_to_methods(
ConcurrentMap<const std::string*, std::unordered_set<const Method*>>&
issue_files_to_methods,
const ConcurrentSet<const Frame*>& frames,
const Context& context,
const Registry& registry,
FrameType frame_type) {
auto frames_to_check = std::make_unique<ConcurrentSet<const Frame*>>(frames);
auto seen_frames = std::make_unique<ConcurrentSet<const Frame*>>(frames);
while (frames_to_check->size() != 0) {
auto new_frames_to_check = std::make_unique<ConcurrentSet<const Frame*>>();
auto queue = sparta::work_queue<const Frame*>([&](const Frame* frame) {
const auto* callee = frame->callee();
if (!callee) {
return;
}
auto callee_model = registry.get(callee);
const auto& callee_port = frame->callee_port();
const auto* method_position = context.positions->get(callee);
if (method_position && method_position->path()) {
issue_files_to_methods.update(
method_position->path(),
[&](const std::string* /*filepath*/,
std::unordered_set<const Method*>& methods,
bool) { methods.emplace(callee); });
}
Taint taint;
if (frame_type == FrameType::Source) {
taint = callee_model.generations().raw_read(callee_port).root();
} else if (frame_type == FrameType::Sink) {
taint = callee_model.sinks().raw_read(callee_port).root();
}
for (const auto& frame_set : taint) {
for (const auto& callee_frame : frame_set) {
if (callee_frame.is_leaf() || !seen_frames->emplace(&callee_frame)) {
continue;
}
new_frames_to_check->emplace(&callee_frame);
}
}
});
for (const auto& frame : *frames_to_check) {
queue.add_item(frame);
}
queue.run_all();
frames_to_check = std::move(new_frames_to_check);
}
}